Class: Macros::Contract::Prepopulate

Inherits:
Base
  • Object
show all
Defined in:
lib/macros/contract/prepopulate.rb

Instance Method Summary collapse

Methods inherited from Base

register

Constructor Details

#initialize(options_key: nil) ⇒ Prepopulate

Returns a new instance of Prepopulate.



6
7
8
# File 'lib/macros/contract/prepopulate.rb', line 6

def initialize(options_key: nil)
  @options_key = options_key
end

Instance Method Details

#call(ctx) ⇒ Object



10
11
12
13
# File 'lib/macros/contract/prepopulate.rb', line 10

def call(ctx, **)
  options = ctx[@options_key] || {}
  ctx['contract.default'].prepopulate!(options)
end