Class: Option
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.none ⇒ Object
41 42 43 |
# File 'lib/totally_lazy/option.rb', line 41 def self.none NONE end |
.option(value) ⇒ Object
33 34 35 |
# File 'lib/totally_lazy/option.rb', line 33 def self.option(value) value.nil? ? none : some(value) end |
Instance Method Details
#flatten ⇒ Object
54 55 56 |
# File 'lib/totally_lazy/option.rb', line 54 def flatten flat_map(identity) end |
#is?(fn_pred = nil, &block_pred) ⇒ Boolean
49 50 51 52 |
# File 'lib/totally_lazy/option.rb', line 49 def is?(fn_pred=nil, &block_pred) assert_funcs(fn_pred, block_given?) exists?(block_given? ? ->(value) { block_pred.call(value) } : fn_pred) end |
#is_defined? ⇒ Boolean
45 46 47 |
# File 'lib/totally_lazy/option.rb', line 45 def is_defined? !is_empty? end |