Class: Macros::Model::Copy

Inherits:
Base
  • Object
show all
Defined in:
lib/macros/model/copy.rb

Instance Method Summary collapse

Methods inherited from Base

register

Constructor Details

#initialize(ctx_key = nil) ⇒ Copy

Returns a new instance of Copy.



6
7
8
# File 'lib/macros/model/copy.rb', line 6

def initialize(ctx_key = nil)
  @ctx_key = ctx_key
end

Instance Method Details

#call(ctx) ⇒ Object



10
11
12
13
14
# File 'lib/macros/model/copy.rb', line 10

def call(ctx, **)
  return false unless ctx[@ctx_key]

  ctx[:model] = ctx[@ctx_key]
end