Class: ActiveInteractor::Context::Runtime

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

Overview

The base class for all runtime context objects

Constant Summary

Constants included from Type::DeclerationMethods

Type::DeclerationMethods::Boolean

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, method_defined?

Methods included from Type::DeclerationMethods::ClassMethods

#any, #list, #union, #untyped

Constructor Details

#initialize(attributes = {}) ⇒ Runtime

Returns a new instance of Runtime.



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

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)



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

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



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

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