Class: ActiveInteractor::Context::Output
- Inherits:
-
Base
- Object
- Base
- ActiveInteractor::Context::Output
show all
- Defined in:
- lib/active_interactor/context/output.rb
Overview
The base class for all output context objects
Constant Summary
Type::DeclerationMethods::Boolean
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.field_names ⇒ Object
16
17
18
|
# File 'lib/active_interactor/context/output.rb', line 16
def self.field_names
attribute_set.attribute_names
end
|
.fields ⇒ Object
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
#as_json(*args, &block) ⇒ Object
7
8
9
|
# File 'lib/active_interactor/context/output.rb', line 7
def as_json(*args, &block)
fields.as_json(*args, &block)
end
|
#fields ⇒ Object
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
|
#to_h(*args, &block) ⇒ Object
8
9
10
|
# File 'lib/active_interactor/context/output.rb', line 8
def to_h(*args, &block)
fields.to_h(*args, &block)
end
|
#to_hash(*args, &block) ⇒ Object
9
10
11
|
# File 'lib/active_interactor/context/output.rb', line 9
def to_hash(*args, &block)
fields.to_hash(*args, &block)
end
|
#to_json(*args, &block) ⇒ Object
10
11
12
|
# File 'lib/active_interactor/context/output.rb', line 10
def to_json(*args, &block)
fields.to_json(*args, &block)
end
|