Class: ActiveInteractor::Context::Output

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

Overview

The base class for all output context objects

Constant Summary

Constants included from Type::DeclerationMethods

Type::DeclerationMethods::Boolean

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, #initialize, method_defined?

Methods included from Type::DeclerationMethods::ClassMethods

#any, #list, #union, #untyped

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::Base

Class Method Details

.field_namesObject



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

def self.field_names
  attribute_set.attribute_names
end

.fieldsObject



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

def self.fields
  attribute_set.attributes
end

.returns(*attribute_args) ⇒ Object



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

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

Instance Method Details

#fieldsObject



24
25
26
27
28
# File 'lib/active_interactor/context/output.rb', line 24

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