Class: Boolean

Inherits:
Object show all
Defined in:
opal/opal/corelib/boolean.rb,
opal/opal/corelib/marshal/write_buffer.rb

Instance Method Summary collapse

Instance Method Details

#!Object



11
12
13
# File 'opal/opal/corelib/boolean.rb', line 11

def !
  `self != true`
end

#&(other) ⇒ Object



15
16
17
# File 'opal/opal/corelib/boolean.rb', line 15

def &(other)
  `(self == true) ? (other !== false && other !== nil) : false`
end

#==(other) ⇒ Object Also known as: equal?, eql?



27
28
29
# File 'opal/opal/corelib/boolean.rb', line 27

def ==(other)
  `(self == true) === other.valueOf()`
end

#^(other) ⇒ Object



23
24
25
# File 'opal/opal/corelib/boolean.rb', line 23

def ^(other)
  `(self == true) ? (other === false || other === nil) : (other !== false && other !== nil)`
end

#__id__Object Also known as: object_id



5
6
7
# File 'opal/opal/corelib/boolean.rb', line 5

def __id__
  `self.valueOf() ? 2 : 0`
end

#__marshal__(buffer) ⇒ Object



8
9
10
11
12
13
14
# File 'opal/opal/corelib/marshal/write_buffer.rb', line 8

def __marshal__(buffer)
  if `self`
    buffer.append('T')
  else
    buffer.append('F')
  end
end

#cloneObject

Raises:



46
47
48
# File 'opal/opal/corelib/boolean.rb', line 46

def clone
  raise TypeError, "can't clone #{self.class}"
end

#dupObject

Raises:



42
43
44
# File 'opal/opal/corelib/boolean.rb', line 42

def dup
  raise TypeError, "can't dup #{self.class}"
end

#singleton_classObject



34
35
36
# File 'opal/opal/corelib/boolean.rb', line 34

def singleton_class
  Boolean
end

#to_sObject



38
39
40
# File 'opal/opal/corelib/boolean.rb', line 38

def to_s
  `(self == true) ? 'true' : 'false'`
end

#|(other) ⇒ Object



19
20
21
# File 'opal/opal/corelib/boolean.rb', line 19

def |(other)
  `(self == true) ? true : (other !== false && other !== nil)`
end