Module: ConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Data::Concern::InstanceMethods Private
- Includes:
- ConvenientService::Support::Copyable
- Defined in:
- lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #result ⇒ Object (also: #__result__) readonly private
- #value ⇒ Object (also: #__value__) readonly private
Instance Method Summary collapse
- #==(other) ⇒ Boolean? private
- #===(other) ⇒ Boolean? private
-
#[](key) ⇒ Object
private
Can be any type.
- #attributes ⇒ Hash{Symbol => Object} (also: #__attributes__) private
- #empty? ⇒ Boolean (also: #__empty__?) private
-
#fetch(key, &block) ⇒ Object
(also: #__fetch__)
private
Can be any type.
- #has_attribute?(key) ⇒ Boolean (also: #__has_attribute__?) private
- #initialize(value:, result: nil) ⇒ void private
- #keys ⇒ Array<Symbol> (also: #__keys__) private
- #struct ⇒ Struct (also: #__struct__) private
- #to_arguments ⇒ ConveninentService::Support::Arguments private
- #to_h ⇒ Hash{Symbol => Object} private
- #to_kwargs ⇒ Hash{Symbol => Object} private
- #to_s ⇒ String private
Methods included from ConvenientService::Support::Copyable
Instance Attribute Details
#result ⇒ Object (readonly) Also known as: __result__
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 47 def result @result end |
#value ⇒ Object (readonly) Also known as: __value__
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 33 def value @value end |
Instance Method Details
#==(other) ⇒ Boolean?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
173 174 175 176 177 178 179 180 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 173 def ==(other) return unless other.instance_of?(self.class) return false if __result__.class != other.__result__.class return false if __value__ != other.__value__ true end |
#===(other) ⇒ Boolean?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Data#=== allows to use RSpec expectation matchers and RSpec mocks arguments matchers for comparison.
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 220 def ===(other) return unless other.instance_of?(self.class) return false if __result__.class != other.__result__.class ## # NOTE: Pattern matching is removed since it causes a huge and annoying warning in Ruby 2.7 apps. Users are too confused by it. # # TODO: Implement a Rubocop cop that forbids the usage of pattern matching until Ruby 2.7 is dropped. # if __value__.instance_of?(::Hash) && other.__value__.instance_of?(::Hash) return false unless Utils::Hash.triple_equality_compare(__value__, other.__value__) else return false unless __value__ === other.__value__ end true end |
#[](key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Can be any type.
151 152 153 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 151 def [](key) __value__.fetch(key.to_sym) { ::ConvenientService.raise Exceptions::NotExistingAttribute.new(attribute: key) } end |
#attributes ⇒ Hash{Symbol => Object} Also known as: __attributes__
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
110 111 112 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 110 def attributes __value__ end |
#empty? ⇒ Boolean Also known as: __empty__?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
82 83 84 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 82 def empty? __value__.empty? end |
#fetch(key, &block) ⇒ Object Also known as: __fetch__
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Can be any type.
160 161 162 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 160 def fetch(key, &block) __value__.fetch(key.to_sym) { block ? yield(self, key) : ::ConvenientService.raise(Exceptions::NotExistingAttribute.new(attribute: key)) } end |
#has_attribute?(key) ⇒ Boolean Also known as: __has_attribute__?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
98 99 100 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 98 def has_attribute?(key) __value__.has_key?(key.to_sym) end |
#initialize(value:, result: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
71 72 73 74 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 71 def initialize(value:, result: nil) @value = value @result = result end |
#keys ⇒ Array<Symbol> Also known as: __keys__
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
125 126 127 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 125 def keys __value__.keys end |
#struct ⇒ Struct Also known as: __struct__
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
137 138 139 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 137 def struct @struct ||= ::Struct.new(*__value__.keys, keyword_init: true).new(__value__) end |
#to_arguments ⇒ ConveninentService::Support::Arguments
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
249 250 251 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 249 def to_arguments @to_arguments ||= Support::Arguments.new(value: __value__, result: __result__) end |
#to_h ⇒ Hash{Symbol => Object}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
256 257 258 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 256 def to_h @to_h ||= __value__.to_h end |
#to_kwargs ⇒ Hash{Symbol => Object}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
242 243 244 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 242 def to_kwargs to_arguments.kwargs end |
#to_s ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
263 264 265 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb', line 263 def to_s @to_s ||= __value__.to_h.to_s end |