Class: FalseClass
- Defined in:
- lib/errgonomic/core_ext/bool.rb,
lib/errgonomic/core_ext/blank.rb
Overview
The false halves of the conversions above.
Instance Method Summary collapse
-
#blank? ⇒ true
falseis blank:. - #ok_or(err) ⇒ Object
- #ok_or_else(&block) ⇒ Object
-
#present? ⇒ Boolean
:nodoc:.
-
#then_some(*args, &block) ⇒ Object
The block is never called; arguments are validated all the same, so a misuse fails regardless of which way the flag happens to point.
Instance Method Details
#blank? ⇒ true
false is blank:
false.blank? # => true
71 72 73 |
# File 'lib/errgonomic/core_ext/blank.rb', line 71 def blank? true end |
#ok_or(err) ⇒ Object
59 60 61 |
# File 'lib/errgonomic/core_ext/bool.rb', line 59 def ok_or(err) Err(err) end |
#ok_or_else(&block) ⇒ Object
65 66 67 |
# File 'lib/errgonomic/core_ext/bool.rb', line 65 def ok_or_else(&block) Err(block.call) end |
#present? ⇒ Boolean
:nodoc:
75 76 77 |
# File 'lib/errgonomic/core_ext/blank.rb', line 75 def present? # :nodoc: false end |
#then_some(*args, &block) ⇒ Object
The block is never called; arguments are validated all the same, so a misuse fails regardless of which way the flag happens to point.
49 50 51 52 53 54 55 |
# File 'lib/errgonomic/core_ext/bool.rb', line 49 def then_some(*args, &block) unless (args.length == 1 && !block) || (args.empty? && block) raise Errgonomic::ArgumentError, 'then_some takes either a value or a block' end None() end |