Class: ActiveInteractor::Context::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/active_interactor/context/result.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Result

Returns a new instance of Result.



15
16
17
# File 'lib/active_interactor/context/result.rb', line 15

def initialize(attributes = {})
  attributes.each_pair { |key, value| instance_variable_set(:"@#{key}", value) }
end

Class Method Details

.for_output_context(owner, context) ⇒ Object



10
11
12
13
# File 'lib/active_interactor/context/result.rb', line 10

def self.for_output_context(owner, context)
  context.fields.each_key { |field| owner::ResultContext.send(:attr_reader, field) }
  owner::ResultContext.new(context.fields)
end

.register_owner(owner) ⇒ Object



6
7
8
# File 'lib/active_interactor/context/result.rb', line 6

def self.register_owner(owner)
  owner.const_set(:ResultContext, Class.new(self))
end