Class: Escape::StringWrapper

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

Overview

:nodoc:all

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ StringWrapper

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_dupObject



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

#hashObject



59
60
61
# File 'lib/esc.rb', line 59

def hash
  @str.hash
end

#inspectObject



50
51
52
# File 'lib/esc.rb', line 50

def inspect
  "\#<#{self.class}: #{@str}>"
end

#to_sObject



46
47
48
# File 'lib/esc.rb', line 46

def to_s
  @str.dup
end