Skip to content

Commit

Permalink
Merge pull request #60 from shigemk2/typo_registry
Browse files Browse the repository at this point in the history
Fix typo: registory to registry
  • Loading branch information
eisuke authored May 22, 2017
2 parents c1bc666 + 7c9a75f commit 5be304f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions lib/autoload/kuroko2/workflow/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Kuroko2
module Workflow
class Node
PATH_REGEXP = %r(\A(?:/|(?:/\d+-[a-z0-9_]+)+)\z)
TASK_REGISTORY = {
TASK_REGISTRY = {
root: Task::Sequence,
noop: Task::Noop,
sequence: Task::Sequence,
Expand All @@ -28,20 +28,20 @@ class Node
def self.register(key: nil, klass:)
key ||= klass.to_s.demodulize.underscore.to_sym

unless TASK_REGISTORY.has_key?(key)
TASK_REGISTORY.store(key, klass)
unless TASK_REGISTRY.has_key?(key)
TASK_REGISTRY.store(key, klass)
else
Kuroko2.logger.warn("Unable to add '#{klass}' to task registory. '#{TASK_REGISTORY[key]}' is already registered.")
Kuroko2.logger.warn("Unable to add '#{klass}' to task registry. '#{TASK_REGISTRY[key]}' is already registered.")
end
end

def self.deregister(key)
TASK_REGISTORY.delete(key)
TASK_REGISTRY.delete(key)
end

def initialize(type, option = nil)
@type = type.to_sym
@task_klass = TASK_REGISTORY.fetch(@type, nil)
@task_klass = TASK_REGISTRY.fetch(@type, nil)
@option = option.try(:strip)
@parent = nil
@children = []
Expand Down
2 changes: 1 addition & 1 deletion lib/kuroko2/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Engine < ::Rails::Engine

if Kuroko2.config.custom_tasks
Kuroko2.config.custom_tasks.each do |key, klass|
unless Workflow::Node::TASK_REGISTORY.has_key?(key)
unless Workflow::Node::TASK_REGISTRY.has_key?(key)
Workflow::Node.register(
key: key.to_sym,
klass: Workflow::Task.const_get(klass, false)
Expand Down
2 changes: 1 addition & 1 deletion spec/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Kuroko2
describe 'Check if settings is loaded' do
it 'loads custom tasks' do
expect(Workflow::Node::TASK_REGISTORY).to have_key(:custom_task1)
expect(Workflow::Node::TASK_REGISTRY).to have_key(:custom_task1)
expect(Workflow::ScriptParser.new('custom_task1:').parse).to be_a(Workflow::Node)
end
end
Expand Down

0 comments on commit 5be304f

Please sign in to comment.