Class: Errgonomic::Option::None

Inherits:
Any show all
Defined in:
lib/errgonomic/option.rb,
lib/errgonomic/rails/active_record_optional.rb

Overview

A None answers nil? like nil itself, so ActiveRecord internals that check for nil treat an absent value as absent.

Constant Summary

Constants inherited from Any

Any::RUST_SPELLINGS

Instance Method Summary collapse

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Errgonomic::Option::Any

Instance Method Details

#inspectObject

Examples:

None().inspect # => "None"


683
684
685
# File 'lib/errgonomic/option.rb', line 683

def inspect
  'None'
end

#nil?Boolean

Returns:

  • (Boolean)


222
223
224
# File 'lib/errgonomic/rails/active_record_optional.rb', line 222

def nil?
  true
end

#none?Boolean

Returns:

  • (Boolean)


677
678
679
# File 'lib/errgonomic/option.rb', line 677

def none?
  true
end

#some?Boolean

Returns:

  • (Boolean)


673
674
675
# File 'lib/errgonomic/option.rb', line 673

def some?
  false
end