Class: Stretto::Value::NumericValue
- Defined in:
- lib/stretto/music_elements/modifiers/value.rb
Overview
Wraps a numeric value
Instance Attribute Summary collapse
-
#numeric ⇒ Object
readonly
Returns the value of attribute numeric.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
True if the value it is holding is equal to other’s value.
-
#initialize(numeric) ⇒ NumericValue
constructor
A new instance of NumericValue.
-
#to_f(pattern) ⇒ Float
The numeric value coerced to a float.
-
#to_i(pattern) ⇒ Integer
The numeric value coerced to an integer.
-
#to_s ⇒ String
The string representation of the numeric value.
Constructor Details
#initialize(numeric) ⇒ NumericValue
Returns a new instance of NumericValue.
19 20 21 |
# File 'lib/stretto/music_elements/modifiers/value.rb', line 19 def initialize(numeric) @numeric = numeric end |
Instance Attribute Details
#numeric ⇒ Object (readonly)
Returns the value of attribute numeric.
16 17 18 |
# File 'lib/stretto/music_elements/modifiers/value.rb', line 16 def numeric @numeric end |
Instance Method Details
#==(other) ⇒ Boolean
Returns True if the value it is holding is equal to other’s value.
34 35 36 |
# File 'lib/stretto/music_elements/modifiers/value.rb', line 34 def ==(other) other.kind_of?(NumericValue) && other.numeric == @numeric end |
#to_f(pattern) ⇒ Float
Returns The numeric value coerced to a float.
29 30 31 |
# File 'lib/stretto/music_elements/modifiers/value.rb', line 29 def to_f(pattern) @numeric.to_f end |
#to_i(pattern) ⇒ Integer
Returns The numeric value coerced to an integer.
24 25 26 |
# File 'lib/stretto/music_elements/modifiers/value.rb', line 24 def to_i(pattern) @numeric.to_i end |
#to_s ⇒ String
Returns The string representation of the numeric value.
39 40 41 |
# File 'lib/stretto/music_elements/modifiers/value.rb', line 39 def to_s @numeric.to_s end |