Class: NokogiriString

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nokogiri) ⇒ NokogiriString

Returns a new instance of NokogiriString.



4
5
6
# File 'lib/mason_helper.rb', line 4

def initialize(nokogiri)
  @nokogiri = nokogiri
end

Instance Attribute Details

#nokogiriObject (readonly)

Returns the value of attribute nokogiri.



2
3
4
# File 'lib/mason_helper.rb', line 2

def nokogiri
  @nokogiri
end

Instance Method Details

#bytesizeObject



19
20
21
# File 'lib/mason_helper.rb', line 19

def bytesize
  to_str.bytesize
end

#kind_of?(what) ⇒ Boolean

A NokogiriString is not really a String, but is good enought in the Rack context to act like one.

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/mason_helper.rb', line 10

def kind_of?(what)
  return true if what == String
  super
end

#to_sObject



23
24
25
# File 'lib/mason_helper.rb', line 23

def to_s
  to_str
end

#to_strObject



15
16
17
# File 'lib/mason_helper.rb', line 15

def to_str
  @to_str ||= @nokogiri.to_s
end