class Collins::Some

Represents a present value

A number of equality and comparison methods are implemented so that `Some` values are compared using the value of `x`.

Attributes

x[R]

Public Class Methods

new(value) click to toggle source
# File lib/collins/option.rb, line 196
def initialize value
  @x = value
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/collins/option.rb, line 212
def <=>(other)
  self.class == other.class ?
    (x <=> other.x) : nil
end
==(other)
Alias for: eql?
empty?() click to toggle source
# File lib/collins/option.rb, line 199
def empty?
  false
end
eql?(other) click to toggle source
# File lib/collins/option.rb, line 205
def eql? other
  self.class.equal?(other.class) && x.eql?(other.x)
end
Also aliased as: ==
get() click to toggle source
# File lib/collins/option.rb, line 202
def get
  x
end
hash() click to toggle source
# File lib/collins/option.rb, line 209
def hash
  x.hash
end