Class: Govspeak::PostProcessor
- Inherits:
-
Object
- Object
- Govspeak::PostProcessor
- Defined in:
- lib/govspeak/post_processor.rb
Class Attribute Summary collapse
-
.extensions ⇒ Object
readonly
Returns the value of attribute extensions.
Instance Attribute Summary collapse
-
#govspeak_document ⇒ Object
readonly
Returns the value of attribute govspeak_document.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(html, govspeak_document) ⇒ PostProcessor
constructor
A new instance of PostProcessor.
- #output ⇒ Object
Constructor Details
#initialize(html, govspeak_document) ⇒ PostProcessor
Returns a new instance of PostProcessor.
163 164 165 166 |
# File 'lib/govspeak/post_processor.rb', line 163 def initialize(html, govspeak_document) @input = html @govspeak_document = govspeak_document end |
Class Attribute Details
.extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
6 7 8 |
# File 'lib/govspeak/post_processor.rb', line 6 def extensions @extensions end |
Instance Attribute Details
#govspeak_document ⇒ Object (readonly)
Returns the value of attribute govspeak_document.
161 162 163 |
# File 'lib/govspeak/post_processor.rb', line 161 def govspeak_document @govspeak_document end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
161 162 163 |
# File 'lib/govspeak/post_processor.rb', line 161 def input @input end |
Class Method Details
.extension(title, &block) ⇒ Object
13 14 15 |
# File 'lib/govspeak/post_processor.rb', line 13 def self.extension(title, &block) @extensions << [title, block] end |
.process(html, govspeak_document) ⇒ Object
9 10 11 |
# File 'lib/govspeak/post_processor.rb', line 9 def self.process(html, govspeak_document) new(html, govspeak_document).output end |
Instance Method Details
#output ⇒ Object
168 169 170 171 172 173 174 |
# File 'lib/govspeak/post_processor.rb', line 168 def output document = nokogiri_document self.class.extensions.each do |(_, block)| instance_exec(document, &block) end document.to_html end |