Method: Formed::Base#with_context

Defined in:
lib/formed/base.rb

#with_context(contexts = {}) ⇒ Object



101
102
103
104
105
106
107
108
109
110
# File 'lib/formed/base.rb', line 101

def with_context(contexts = {})
  @context = OpenStruct.new(contexts)
  _reflections.each do |_, reflection|
    if (instance = public_send(reflection.name))
      instance.with_context(@context)
    end
  end

  self
end