Module: UseCases::DSL

Includes:
ActiveSupport::Inflector
Included in:
UseCase
Defined in:
lib/use_cases/dsl.rb

Instance Method Summary collapse

Instance Method Details

#__steps__Object



21
22
23
# File 'lib/use_cases/dsl.rb', line 21

def __steps__
  @__steps__ ||= []
end

#register_adapter(step_class) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/use_cases/dsl.rb', line 9

def register_adapter(step_class)
  step_name = underscore(demodulize(step_class.name))

  define_singleton_method(step_name) do |name, options = {}|
    __steps__ << step_class.new(name, nil, options)
  end
end

#remove_step(name) ⇒ Object



17
18
19
# File 'lib/use_cases/dsl.rb', line 17

def remove_step(name)
  __steps__.delete_if { |step| step.name == name }
end