Class: Rubyang::Xpath::BasicType::Boolean

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyang/xpath.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#valueObject (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_booleanObject



80
81
82
# File 'lib/rubyang/xpath.rb', line 80

def to_boolean
  self
end