Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo: registory to registry #60

Merged
merged 1 commit into from
May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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