class Fear::Some
Constants
- EXTRACTOR
Attributes
value[R]
Public Class Methods
new(value)
click to toggle source
# File lib/fear/some.rb, line 22 def initialize(value) @value = value end
Public Instance Methods
==(other)
click to toggle source
@param other [Any] @return [Boolean]
# File lib/fear/some.rb, line 61 def ==(other) other.is_a?(Some) && get == other.get end
deconstruct()
click to toggle source
@return [Array<any>]
# File lib/fear/some.rb, line 95 def deconstruct [get] end
empty?()
click to toggle source
@return [false]
# File lib/fear/some.rb, line 37 def empty? false end
filter_map(&filter)
click to toggle source
@return [RightBiased::Left, RightBiased::Right]
# File lib/fear/some.rb, line 90 def filter_map(&filter) map(&filter).select(&:itself) end
get()
click to toggle source
@return [any]
# File lib/fear/some.rb, line 27 def get @value end
inspect()
click to toggle source
@return [String]
# File lib/fear/some.rb, line 66 def inspect "#<Fear::Some get=#{value.inspect}>" end
Also aliased as: to_s
or_nil()
click to toggle source
@return [any]
# File lib/fear/some.rb, line 32 def or_nil @value end
reject() { |value| ... }
click to toggle source
@return [Option]
# File lib/fear/some.rb, line 51 def reject if yield(value) None else self end end
select() { |value| ... }
click to toggle source
@return [Option]
# File lib/fear/some.rb, line 42 def select if yield(value) self else None end end
zip(other) { |value, x| ... }
click to toggle source
@param other [Fear::Option] @return [Fear::Option]
# File lib/fear/some.rb, line 75 def zip(other) if other.is_a?(Option) other.map do |x| if block_given? yield(value, x) else [value, x] end end else raise TypeError, "can't zip with #{other.class}" end end