Class: HpM118dwx4

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename = 'page.html', pages: 8, debug: false) ⇒ HpM118dwx4

Returns a new instance of HpM118dwx4.



17
18
19
20
21
# File 'lib/hpm118dwx4.rb', line 17

def initialize(filename='page.html', pages: 8, debug: false)

  @filename, @pages, @debug = filename, [' ']*pages, debug

end

Instance Attribute Details

#pagesObject

Returns the value of attribute pages.



14
15
16
# File 'lib/hpm118dwx4.rb', line 14

def pages
  @pages
end

#to_htmlObject (readonly)

Returns the value of attribute to_html.



13
14
15
# File 'lib/hpm118dwx4.rb', line 13

def to_html
  @to_html
end

Instance Method Details

#buildObject



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

def build()
  @to_html = build_html @pages
  @doc = Rexle.new(@to_html)
end

#save(filename = @filename) ⇒ Object



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

def save(filename=@filename)
  File.write filename, @doc.xml(pretty: true)
  File.write filename.sub(/\.html$/, '.css'), css()
end