Class: Macros::Model::Copy
Instance Method Summary collapse
- #call(ctx) ⇒ Object
-
#initialize(ctx_key = nil) ⇒ Copy
constructor
A new instance of Copy.
Methods inherited from Base
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 |