Module: Grumlin::WithExtension

Included in:
TraversalStart
Defined in:
lib/grumlin/with_extension.rb

Instance Method Summary collapse

Instance Method Details

#with(name, value) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/grumlin/with_extension.rb', line 4

def with(name, value)
  prev = self
  strategy = if is_a?(with_step_class)
               prev = previous_step
               Grumlin::TraversalStrategies::OptionsStrategy.new(args.first.value.merge(name => value))
             else
               Grumlin::TraversalStrategies::OptionsStrategy.new({ name => value })
             end
  with_step_class.new(:withStrategies, args: [strategy], previous_step: prev)
end