Class: ActiveInteractor::Context::Runtime

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

Constant Summary

Constants included from Type::DeclerationMethods

Type::DeclerationMethods::Boolean

Instance Attribute Summary

Attributes included from ActiveModelErrorMethods

#errors

Instance Method Summary collapse

Methods included from AttributeAssignment

#[], #[]=

Methods included from ActiveModelErrorMethods

#read_attribute_for_validation

Constructor Details

#initialize(attributes = {}) ⇒ Runtime

Returns a new instance of Runtime.



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

def initialize(attributes = {})
  super
  @table = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments) ⇒ Object (private)



31
32
33
34
35
# File 'lib/active_interactor/context/runtime.rb', line 31

def method_missing(method_name, *arguments)
  return assignment_method_missing(method_name, *arguments) if method_name.to_s.end_with?('=')

  read_attribute_value(method_name)
end

Instance Method Details

#attributesObject



11
12
13
14
15
16
# File 'lib/active_interactor/context/runtime.rb', line 11

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