Class: Govspeak::PostProcessor
- Inherits:
-
Object
- Object
- Govspeak::PostProcessor
- Defined in:
- lib/govspeak/post_processor.rb
Constant Summary collapse
- @@extensions =
[]
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(html) ⇒ PostProcessor
constructor
A new instance of PostProcessor.
- #output ⇒ Object
Constructor Details
#initialize(html) ⇒ PostProcessor
Returns a new instance of PostProcessor.
9 10 11 |
# File 'lib/govspeak/post_processor.rb', line 9 def initialize(html) @input = html end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
5 6 7 |
# File 'lib/govspeak/post_processor.rb', line 5 def input @input end |
Class Method Details
.extension(title, &block) ⇒ Object
24 25 26 |
# File 'lib/govspeak/post_processor.rb', line 24 def self.extension(title, &block) @@extensions << [title, block] end |
.process(html) ⇒ Object
20 21 22 |
# File 'lib/govspeak/post_processor.rb', line 20 def self.process(html) new(html).output end |
Instance Method Details
#output ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/govspeak/post_processor.rb', line 28 def output document = nokogiri_document @@extensions.each do |_, block| instance_exec(document, &block) end document.to_html end |