Class: Spine::Transform::Commands::Intercept

Inherits:
Object
  • Object
show all
Defined in:
lib/spine/transform/commands/intercept.rb

Instance Method Summary collapse

Constructor Details

#initialize(key, action, options = {}) ⇒ Intercept

Returns a new instance of Intercept.



5
6
7
8
# File 'lib/spine/transform/commands/intercept.rb', line 5

def initialize(key, action, options = {})
  @key = options.fetch(:to, key)
  @action = action
end

Instance Method Details

#execute(destination, value) ⇒ Object



10
11
12
# File 'lib/spine/transform/commands/intercept.rb', line 10

def execute(destination, value)
  destination[@key] = @action.call(value)
end