Class: ActiveInteractor::Context::Output

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

Constant Summary

Constants included from Type::DeclerationMethods

Type::DeclerationMethods::Boolean

Instance Attribute Summary

Attributes included from ActiveModelErrorMethods

#errors

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from AttributeAssignment

#[], #[]=, #initialize

Methods included from ActiveModelErrorMethods

#read_attribute_for_validation

Constructor Details

This class inherits a constructor from ActiveInteractor::Context::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveInteractor::Context::AttributeAssignment

Class Method Details

.field_namesObject



12
13
14
# File 'lib/active_interactor/context/output.rb', line 12

def self.field_names
  attribute_set.attribute_names
end

.fieldsObject



16
17
18
# File 'lib/active_interactor/context/output.rb', line 16

def self.fields
  attribute_set.attributes
end

.returns(*attribute_args) ⇒ Object



8
9
10
# File 'lib/active_interactor/context/output.rb', line 8

def self.returns(*attribute_args)
  attribute_set.add(*attribute_args)
end

Instance Method Details

#fieldsObject



20
21
22
23
24
# File 'lib/active_interactor/context/output.rb', line 20

def fields
  attribute_set.attributes.each_with_object({}) do |attribute, result|
    result[attribute.name] = attribute.value
  end
end