Class: Mustang::V8::Boolean

Inherits:
Primitive show all
Defined in:
lib/mustang/v8/boolean.rb,
ext/v8/v8_boolean.cpp

Direct Known Subclasses

FalseClass, TrueClass

Instance Method Summary collapse

Methods inherited from Value

#===, #array?, #ary?, #bool?, #boolean?, #date?, #empty?, #external?, #func?, #function?, #int?, #integer?, new, #null?, #num?, #number?, #obj?, #object?, #regex?, #regexp?, #str?, #string?, #to_boolean, #to_integer, #to_number, #to_object, #to_string, #undefined?

Instance Method Details

#&(other) ⇒ Object



16
17
18
# File 'lib/mustang/v8/boolean.rb', line 16

def &(other)
  to_bool & other
end

#<=>(other) ⇒ Object



32
33
34
# File 'lib/mustang/v8/boolean.rb', line 32

def <=>(other)
  to_bool <=> other
end

#==(other) ⇒ Object



28
29
30
# File 'lib/mustang/v8/boolean.rb', line 28

def ==(other)
  to_bool == other
end

#^(other) ⇒ Object



24
25
26
# File 'lib/mustang/v8/boolean.rb', line 24

def ^(other)
  to_bool ^ other
end

#false?Boolean

Returns:



8
9
10
# File 'lib/mustang/v8/boolean.rb', line 8

def false?
  self.is_a?(FalseClass)
end

#kind_of?(klass) ⇒ Boolean

Returns:



36
37
38
# File 'lib/mustang/v8/boolean.rb', line 36

def kind_of?(klass)
  klass == (false? ? false.class : true.class) or super(klass)
end

#to_boolObject



40
41
42
# File 'lib/mustang/v8/boolean.rb', line 40

def to_bool
  false? ? false : true
end

#to_sObject



12
13
14
# File 'lib/mustang/v8/boolean.rb', line 12

def to_s
  to_bool.to_s
end

#true?Boolean

Returns:



4
5
6
# File 'lib/mustang/v8/boolean.rb', line 4

def true?
  self.is_a?(TrueClass)
end

#|(other) ⇒ Object



20
21
22
# File 'lib/mustang/v8/boolean.rb', line 20

def |(other)
  to_bool | other
end