Rename command ADD_REF to REGISTER_REF

This commit is contained in:
Alex Kotov 2023-09-30 03:58:26 +04:00
parent a4102d29f8
commit 2fe72d3ea4
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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
View File

@ -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 #