Class: Escape::StringWrapper
- Inherits:
-
Object
- Object
- Escape::StringWrapper
show all
- Defined in:
- lib/esc.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of StringWrapper.
42
43
44
|
# File 'lib/esc.rb', line 42
def initialize(str)
@str = str
end
|
Class Method Details
.new(str) ⇒ Object
37
38
39
|
# File 'lib/esc.rb', line 37
def new(str)
new_no_dup(str.dup)
end
|
.new_no_dup ⇒ Object
36
|
# File 'lib/esc.rb', line 36
alias new_no_dup new
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
54
55
56
|
# File 'lib/esc.rb', line 54
def ==(other)
other.class == self.class && @str == other.instance_variable_get(:@str)
end
|
#hash ⇒ Object
59
60
61
|
# File 'lib/esc.rb', line 59
def hash
@str.hash
end
|
#inspect ⇒ Object
50
51
52
|
# File 'lib/esc.rb', line 50
def inspect
"\#<#{self.class}: #{@str}>"
end
|
#to_s ⇒ Object
46
47
48
|
# File 'lib/esc.rb', line 46
def to_s
@str.dup
end
|