module KaiserRuby::Refinements

Breaking Ruby for fun and profit!

This module is required to run the code that the transpiler generated, as Rockstar expects somewhat different behaviour of types than Ruby.

Not a single method in here is a good idea and you should probably never use this code outside this gem.

Public Instance Methods

!() click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 568
def !
  if self.is_a?(String)
    self.size.zero?
  elsif self.is_a?(Float) || self.is_a?(Integer)
    self.zero?
  elsif self.is_a?(NilClass)
    true
  else
    self.old_not
  end
end
!=(other) click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 92
def !=(other)
  !self.==(other)
end
*(other) click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 62
def *(other)
  0 * other
end
+(other) click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 50
def +(other)
  return 'null' + other if other.is_a?(String)

  0 + other
end
-(other) click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 56
def -(other)
  return 'null' + other if other.is_a?(String)

  0 - other
end
/(other) click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 66
def /(other)
  0 / other
end
<(other) click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 70
def <(other)
  0 < other
end
<=(other) click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 78
def <=(other)
  0 <= other
end
==(other) click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 86
def ==(other)
  return false if other.is_a?(String) || other.is_a?(KaiserRuby::Mysterious) || other.is_a?(FalseClass) || other.is_a?(TrueClass)

  0 == other
end
>(other) click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 74
def >(other)
  0 > other
end
>=(other) click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 82
def >=(other)
  0 >= other
end
__booleanize() click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 420
def __booleanize
  # spec says these should be converted but tests says they should not. weird
  # return false if self =~ /\A\bfalse\b|\bno\b|\blies\b|\bwrong\b\Z/i
  # return true if self =~ /\A\btrue\b|\byes\b|\bok\b|\bright\b\Z/i

  true
end
to_bool() click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 46
def to_bool
  false
end
to_s() click to toggle source
# File lib/kaiser_ruby/refinements.rb, line 96
def to_s
  'null'
end