Class: VCDOM::XPath::Internal::BooleanValue
- Inherits:
-
AbstractValue
- Object
- AbstractValue
- VCDOM::XPath::Internal::BooleanValue
- Defined in:
- lib/vcdom/xpath/internal/value.rb
Overview
:nodoc:
Constant Summary collapse
- TRUE =
self.new( true )
- FALSE =
self.new( false )
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(val) ⇒ BooleanValue
constructor
A new instance of BooleanValue.
- #to_boolean_value ⇒ Object
-
#to_number_value ⇒ Object
convert a BooleanValue object to a NumberValue object.
- #to_string_value ⇒ Object
- #value_type ⇒ Object
Methods inherited from AbstractValue
#%, #*, #+, #-, #-@, #/, #<, #<=, #<=>, #==, #>, #>=, #is_command?, #is_expr?, #is_value?, #neq?, #to_s, #|
Constructor Details
#initialize(val) ⇒ BooleanValue
Returns a new instance of BooleanValue.
174 175 176 |
# File 'lib/vcdom/xpath/internal/value.rb', line 174 def initialize( val ) @value = !! val end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
193 194 195 |
# File 'lib/vcdom/xpath/internal/value.rb', line 193 def value @value end |
Class Method Details
.false ⇒ Object
199 |
# File 'lib/vcdom/xpath/internal/value.rb', line 199 def self.false; FALSE end |
.true ⇒ Object
198 |
# File 'lib/vcdom/xpath/internal/value.rb', line 198 def self.true; TRUE end |
Instance Method Details
#to_boolean_value ⇒ Object
189 190 191 |
# File 'lib/vcdom/xpath/internal/value.rb', line 189 def to_boolean_value() self end |
#to_number_value ⇒ Object
convert a BooleanValue object to a NumberValue object. オプションの空白にオプションの負号 1 個が続き, [0-9](“.” [0-9]*)? | “.” [0-9]+ が続いて空白が続いたものからなる文字列は, その文字列が表す数学的値に (IEEE 754 最近接値丸めルールに従い) 最も近い IEEE 754 数値に変換される. その他の文字列はどれも NaN に変換される.
185 186 187 |
# File 'lib/vcdom/xpath/internal/value.rb', line 185 def to_number_value() @value ? NumberValue.new( 1.0 ) : NumberValue.new( 0.0 ) end |
#to_string_value ⇒ Object
177 178 179 |
# File 'lib/vcdom/xpath/internal/value.rb', line 177 def to_string_value() @value ? StringValue.new("true") : StringValue.new("false") end |
#value_type ⇒ Object
194 |
# File 'lib/vcdom/xpath/internal/value.rb', line 194 def value_type; :boolean end |