Class: Rubyang::Xpath::BasicType::Boolean
- Inherits:
-
Object
- Object
- Rubyang::Xpath::BasicType::Boolean
- Defined in:
- lib/rubyang/xpath.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #and(right) ⇒ Object
-
#initialize(value) ⇒ Boolean
constructor
A new instance of Boolean.
- #or(right) ⇒ Object
- #to_boolean ⇒ Object
Constructor Details
#initialize(value) ⇒ Boolean
Returns a new instance of Boolean.
75 76 77 78 |
# File 'lib/rubyang/xpath.rb', line 75 def initialize value raise "#{self.class} argument must be true or false but #{value.class}" unless [true, false].include?( value ) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
74 75 76 |
# File 'lib/rubyang/xpath.rb', line 74 def value @value end |
Instance Method Details
#and(right) ⇒ Object
84 85 86 87 |
# File 'lib/rubyang/xpath.rb', line 84 def and right value = (@value and right.to_boolean.value) Boolean.new value end |
#or(right) ⇒ Object
89 90 91 92 |
# File 'lib/rubyang/xpath.rb', line 89 def or right value = (@value or right.to_boolean.value) Boolean.new value end |
#to_boolean ⇒ Object
80 81 82 |
# File 'lib/rubyang/xpath.rb', line 80 def to_boolean self end |