Rename command ADD_REF to REGISTER_REF
This commit is contained in:
parent
a4102d29f8
commit
2fe72d3ea4
3 changed files with 10 additions and 10 deletions
|
@ -56,9 +56,9 @@ while (line = $stdin.gets)
|
|||
data = JSON.parse rest
|
||||
config.kinds.register String(data).to_sym
|
||||
success
|
||||
when 'ADD_REF'
|
||||
when 'REGISTER_REF'
|
||||
data = JSON.parse rest
|
||||
config.repo.add_ref(**data.transform_keys(&:to_sym))
|
||||
config.repo.register_ref(**data.transform_keys(&:to_sym))
|
||||
success
|
||||
when 'ADD_NOTE'
|
||||
config.freeze
|
||||
|
|
|
@ -15,7 +15,7 @@ module Referator
|
|||
super
|
||||
end
|
||||
|
||||
def add_ref(**kwargs)
|
||||
def register_ref(**kwargs)
|
||||
reference = Reference.new(**kwargs)
|
||||
key = "#{reference.kind}-#{reference.id}".freeze
|
||||
raise 'Reference already exists' if @references.key? key
|
||||
|
|
14
test.rb
14
test.rb
|
@ -108,14 +108,14 @@ cmd :REGISTER_FORMAT, { name: :json,
|
|||
{ template: nil },
|
||||
{ format: nil }] }
|
||||
|
||||
###########
|
||||
# ADD_REF #
|
||||
###########
|
||||
################
|
||||
# REGISTER_REF #
|
||||
################
|
||||
|
||||
cmd :ADD_REF, RAW_REFS[:self][:foo]
|
||||
cmd :ADD_REF, RAW_REFS[:self][:bar]
|
||||
cmd :ADD_REF, RAW_REFS[:link][:example_com]
|
||||
cmd :ADD_REF, RAW_REFS[:link][:causa_arcana_com]
|
||||
cmd :REGISTER_REF, RAW_REFS[:self][:foo]
|
||||
cmd :REGISTER_REF, RAW_REFS[:self][:bar]
|
||||
cmd :REGISTER_REF, RAW_REFS[:link][:example_com]
|
||||
cmd :REGISTER_REF, RAW_REFS[:link][:causa_arcana_com]
|
||||
|
||||
#######
|
||||
# REF #
|
||||
|
|
Loading…
Reference in a new issue