Class: Code::Object::Boolean

Inherits:
Code::Object show all
Defined in:
lib/code/object/boolean.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Code::Object

#<=>, #==, #call, #falsy?, #hash

Constructor Details

#initialize(raw) ⇒ Boolean

Returns a new instance of Boolean.



6
7
8
# File 'lib/code/object/boolean.rb', line 6

def initialize(raw)
  @raw = raw
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



4
5
6
# File 'lib/code/object/boolean.rb', line 4

def raw
  @raw
end

Instance Method Details

#inspectObject



22
23
24
# File 'lib/code/object/boolean.rb', line 22

def inspect
  to_s
end

#succObject



14
15
16
# File 'lib/code/object/boolean.rb', line 14

def succ
  ::Code::Object::Boolean.new(!raw)
end

#to_sObject



18
19
20
# File 'lib/code/object/boolean.rb', line 18

def to_s
  raw.to_s
end

#truthy?Boolean

Returns:



10
11
12
# File 'lib/code/object/boolean.rb', line 10

def truthy?
  raw
end