Class: Speq::SomeValue

Inherits:
Object
  • Object
show all
Defined in:
lib/speq/values.rb,
lib/speq/string_fmt.rb

Overview

Holds any value allowing for a distiction between Some(nil) and None

Direct Known Subclasses

Message, Subject

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, description = nil) ⇒ SomeValue

Returns a new instance of SomeValue.



74
75
76
77
# File 'lib/speq/values.rb', line 74

def initialize(value, description = nil)
  @value = value
  @description = description
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



72
73
74
# File 'lib/speq/values.rb', line 72

def description
  @description
end

#valueObject (readonly)

Returns the value of attribute value.



71
72
73
# File 'lib/speq/values.rb', line 71

def value
  @value
end

Instance Method Details

#to_sObject



73
74
75
# File 'lib/speq/string_fmt.rb', line 73

def to_s
  description || value.inspect
end