class Mingle::MingleString
Note: it’s important that this class be defined before things like MingleNamespace
, MingleIdentifier
, etc, which register parse handlers for values of type MingleString
.
Public Class Methods
new( str )
click to toggle source
# File lib/mingle.rb, line 38 def initialize( str ) @str = not_nil( str, "str" ).to_s.dup end
Public Instance Methods
<=>( other )
click to toggle source
# File lib/mingle.rb, line 43 def <=>( other ) if other.class == self.class @str <=> other.str else raise TypeError, "Not a #{self.class}: #{other.class}" end end
==( other )
click to toggle source
# File lib/mingle.rb, line 63 def ==( other ) return true if other.equal?( self ) return false unless other.is_a?( MingleString ) other_str = other.instance_variable_get( :@str ) @str == other_str end
eql?( other )
click to toggle source
# File lib/mingle.rb, line 73 def eql?( other ) self == other end
hash()
click to toggle source
# File lib/mingle.rb, line 78 def hash @str.hash end
inspect()
click to toggle source
# File lib/mingle.rb, line 58 def inspect to_s.inspect end
to_i()
click to toggle source
# File lib/mingle.rb, line 83 def to_i @str.to_i end
to_s()
click to toggle source
# File lib/mingle.rb, line 53 def to_s @str.to_s end