Class: Kompress::HTML

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ HTML

Returns a new instance of HTML.



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/kompress/kompress.rb', line 30

def initialize(html)
  @html = html
  
  # take out spaces between the beginning or any number
  # of spaces until a tag
  @html.gsub!(/(?:^|\s+?)(<.*?>)/, '\1')
  
  # take out spaces between a tag and the end.
  @html.gsub!(/(<.*?>)(?:\s+)$/,'\1')
  
  @html
end

Instance Attribute Details

#htmlObject (readonly)

Returns the value of attribute html.



28
29
30
# File 'lib/kompress/kompress.rb', line 28

def html
  @html
end