Class: Errgonomic::Option::Some
- Defined in:
- lib/errgonomic/option.rb,
lib/errgonomic/rails/active_record_optional.rb
Overview
Delegate ActiveRecord lifecycle checks to the wrapped record, so a Some can stand in for its record during persistence.
Constant Summary
Constants inherited from Any
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ Some
constructor
A new instance of Some.
-
#inspect ⇒ Object
Render like Rust's Debug, delegating to the inner value's inspect so nesting stays unambiguous.
- #none? ⇒ Boolean
- #some? ⇒ Boolean
Methods inherited from Any
#<=>, #==, #and, #and_then, #as_json, #blank?, #blank_or, #blank_or_else, #blank_or_raise!, #deconstruct, #eql?, #expect!, #filter, #flatten, #hash, #map, #map_or, #map_or_else, #method_missing, #none_or, #ok, #ok_or, #ok_or_else, #or, #or_else, #presence, #present?, #present_or, #present_or_else, #present_or_raise!, #pretty_print, #respond_to_missing?, #some_and, #tap_some, #to_a, #to_json, #to_option, #to_s, #unwrap!, #unwrap_or, #unwrap_or_else, #xor, #zip, #zip_with
Constructor Details
#initialize(value) ⇒ Some
Returns a new instance of Some.
645 646 647 648 |
# File 'lib/errgonomic/option.rb', line 645 def initialize(value) super() @value = value end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Errgonomic::Option::Any
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
643 644 645 |
# File 'lib/errgonomic/option.rb', line 643 def value @value end |
Instance Method Details
#inspect ⇒ Object
Render like Rust's Debug, delegating to the inner value's inspect so nesting stays unambiguous.
666 667 668 |
# File 'lib/errgonomic/option.rb', line 666 def inspect "Some(#{value.inspect})" end |
#none? ⇒ Boolean
654 655 656 |
# File 'lib/errgonomic/option.rb', line 654 def none? false end |
#some? ⇒ Boolean
650 651 652 |
# File 'lib/errgonomic/option.rb', line 650 def some? true end |