Class: KaiserRuby::Mysterious

Inherits:
Object
  • Object
show all
Defined in:
lib/kaiser_ruby/refinements.rb

Overview

Rockstar introduces a new type that is similar to JS’ undefined Ruby obviously doesn’t have that so we have to make our own

Instance Method Summary collapse

Instance Method Details

#!Object



23
24
25
# File 'lib/kaiser_ruby/refinements.rb', line 23

def !
  true
end

#!=(other) ⇒ Object



33
34
35
# File 'lib/kaiser_ruby/refinements.rb', line 33

def !=(other)
  !self.==(other)
end

#+(other) ⇒ Object



11
12
13
# File 'lib/kaiser_ruby/refinements.rb', line 11

def +(other)
  'mysterious' + other if other.is_a?(String)
end

#-(other) ⇒ Object



15
16
17
# File 'lib/kaiser_ruby/refinements.rb', line 15

def -(other)
  'mysterious' + other if other.is_a?(String)
end

#==(other) ⇒ Object



27
28
29
30
31
# File 'lib/kaiser_ruby/refinements.rb', line 27

def ==(other)
  return true if other.is_a?(KaiserRuby::Mysterious)

  false
end

#to_boolObject



7
8
9
# File 'lib/kaiser_ruby/refinements.rb', line 7

def to_bool
  false
end

#to_sObject



19
20
21
# File 'lib/kaiser_ruby/refinements.rb', line 19

def to_s
  'mysterious'
end