Class: SmartCore::Operation::Success
- Defined in:
- lib/smart_core/operation/success.rb
Overview
Instance Attribute Summary
Attributes inherited from Result
#__result_attributes__, #__result_options__
Instance Method Summary collapse
- #initialize(**result_options) ⇒ void constructor
- #success? {|nil| ... } ⇒ Boolean
-
#to_h ⇒ Hash
(also: #to_hash)
Support for operations like ‘result.success? { |**result| …result-as-a-hash… }`.
Methods inherited from Result
Constructor Details
#initialize(**result_options) ⇒ void
11 12 13 14 15 |
# File 'lib/smart_core/operation/success.rb', line 11 def initialize(**) __prevent_method_overlapping__() super(**) # NOTE: initialize result object __define_virtual_result_data_accessors__() end |
Instance Method Details
#success? {|nil| ... } ⇒ Boolean
22 23 24 |
# File 'lib/smart_core/operation/success.rb', line 22 def success? true.tap { yield(self) if block_given? } end |
#to_h ⇒ Hash Also known as: to_hash
Support for operations like ‘result.success? { |**result| …result-as-a-hash… }`
32 33 34 |
# File 'lib/smart_core/operation/success.rb', line 32 def to_h .dup end |