Class: Bruhl::QuotedString

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/bruhl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ QuotedString

Returns a new instance of QuotedString.



82
83
84
# File 'lib/bruhl.rb', line 82

def initialize(str)
  @str = str
end

Instance Attribute Details

#strObject (readonly)

Returns the value of attribute str.



81
82
83
# File 'lib/bruhl.rb', line 81

def str
  @str
end

Instance Method Details

#<=>(other) ⇒ Object



86
87
88
# File 'lib/bruhl.rb', line 86

def <=>(other)
   other.respond_to?(:to_str) && @str <=> other.to_str
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/bruhl.rb', line 90

def eql?(other)
  self == other
end

#hashObject



94
95
96
# File 'lib/bruhl.rb', line 94

def hash
  @str.hash
end

#inspectObject



98
99
100
# File 'lib/bruhl.rb', line 98

def inspect
  to_s
end

#to_sObject



102
103
104
# File 'lib/bruhl.rb', line 102

def to_s
  @str
end

#to_strObject



106
107
108
# File 'lib/bruhl.rb', line 106

def to_str
  @str
end