Class: Service::Result
- Inherits:
-
Object
- Object
- Service::Result
- Includes:
- ActiveModel::API, ActiveModel::Attributes
- Defined in:
- app/concerns/service.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#to_hash ⇒ Object
(also: #to_h)
Hash compatibility — the old Virtus struct responded to [] and to_hash.
- #to_hash_with_params ⇒ Object
Instance Method Details
#[](key) ⇒ Object
45 46 47 |
# File 'app/concerns/service.rb', line 45 def [](key) to_hash[key.to_sym] end |
#to_hash ⇒ Object Also known as: to_h
Hash compatibility — the old Virtus struct responded to [] and to_hash.
Callers that do result[:output], result.to_hash, or **result still work.
:params is excluded because it holds the internal attributes_used snapshot
and was never part of the public contract.
40 41 42 |
# File 'app/concerns/service.rb', line 40 def to_hash attributes.transform_keys(&:to_sym).except(:params) end |
#to_hash_with_params ⇒ Object
49 50 51 |
# File 'app/concerns/service.rb', line 49 def to_hash_with_params attributes.transform_keys(&:to_sym) end |