Class: Rubyang::Xpath::BasicType::Number
- Inherits:
-
Object
- Object
- Rubyang::Xpath::BasicType::Number
- Defined in:
- lib/rubyang/xpath.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #!=(right) ⇒ Object
- #*(right) ⇒ Object
- #+(right) ⇒ Object
- #-(right) ⇒ Object
- #-@ ⇒ Object
- #/(right) ⇒ Object
- #==(right) ⇒ Object
-
#initialize(value) ⇒ Number
constructor
A new instance of Number.
- #to_boolean ⇒ Object
Constructor Details
#initialize(value) ⇒ Number
Returns a new instance of Number.
97 98 99 |
# File 'lib/rubyang/xpath.rb', line 97 def initialize value @value = Float(value) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
96 97 98 |
# File 'lib/rubyang/xpath.rb', line 96 def value @value end |
Instance Method Details
#!=(right) ⇒ Object
161 162 163 164 165 166 167 168 169 |
# File 'lib/rubyang/xpath.rb', line 161 def != right case right when Number value = (@value != right.value) Boolean.new value else raise end end |
#*(right) ⇒ Object
131 132 133 134 135 136 137 138 139 |
# File 'lib/rubyang/xpath.rb', line 131 def * right case right when Number value = (@value * right.value) Number.new value else raise end end |
#+(right) ⇒ Object
111 112 113 114 115 116 117 118 119 |
# File 'lib/rubyang/xpath.rb', line 111 def + right case right when Number value = (@value + right.value) Number.new value else raise end end |
#-(right) ⇒ Object
121 122 123 124 125 126 127 128 129 |
# File 'lib/rubyang/xpath.rb', line 121 def - right case right when Number value = (@value - right.value) Number.new value else raise end end |
#-@ ⇒ Object
106 107 108 109 |
# File 'lib/rubyang/xpath.rb', line 106 def -@ value = (- @value) Number.new value end |
#/(right) ⇒ Object
141 142 143 144 145 146 147 148 149 |
# File 'lib/rubyang/xpath.rb', line 141 def / right case right when Number value = (@value / right.value) Number.new value else raise end end |