Class: Twostroke::Runtime::Types::Boolean

Inherits:
Primitive show all
Defined in:
lib/twostroke/runtime/types/boolean.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Value

#has_instance

Constructor Details

#initialize(boolean) ⇒ Boolean

Returns a new instance of Boolean.



11
12
13
# File 'lib/twostroke/runtime/types/boolean.rb', line 11

def initialize(boolean)
  @boolean = boolean
end

Instance Attribute Details

#booleanObject (readonly)

Returns the value of attribute boolean.



10
11
12
# File 'lib/twostroke/runtime/types/boolean.rb', line 10

def boolean
  @boolean
end

Class Method Details

.falseObject



6
7
8
# File 'lib/twostroke/runtime/types/boolean.rb', line 6

def self.false
  @@false ||= Null.new(false)
end

.trueObject



3
4
5
# File 'lib/twostroke/runtime/types/boolean.rb', line 3

def self.true
  @@true ||= Boolean.new(true)
end

Instance Method Details

#===(other) ⇒ Object



15
16
17
# File 'lib/twostroke/runtime/types/boolean.rb', line 15

def ===(other)
  other.is_a?(Boolean) && boolean == other.boolean
end

#typeofObject



19
20
21
# File 'lib/twostroke/runtime/types/boolean.rb', line 19

def typeof
  "boolean"
end