Class: Govspeak::PostProcessor
- Inherits:
-
Object
- Object
- Govspeak::PostProcessor
- Defined in:
- lib/govspeak/post_processor.rb
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.
90 91 92 93 |
# File 'lib/govspeak/post_processor.rb', line 90 def initialize(html, govspeak_document) @input = html @govspeak_document = govspeak_document end |
Instance Attribute Details
#govspeak_document ⇒ Object (readonly)
Returns the value of attribute govspeak_document.
88 89 90 |
# File 'lib/govspeak/post_processor.rb', line 88 def govspeak_document @govspeak_document end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
88 89 90 |
# File 'lib/govspeak/post_processor.rb', line 88 def input @input end |
Class Method Details
.extension(title, &block) ⇒ Object
15 16 17 |
# File 'lib/govspeak/post_processor.rb', line 15 def self.extension(title, &block) @extensions << [title, block] end |
.extensions ⇒ Object
7 8 9 |
# File 'lib/govspeak/post_processor.rb', line 7 def self.extensions @extensions end |
.process(html, govspeak_document) ⇒ Object
11 12 13 |
# File 'lib/govspeak/post_processor.rb', line 11 def self.process(html, govspeak_document) new(html, govspeak_document).output end |
Instance Method Details
#output ⇒ Object
95 96 97 98 99 100 101 |
# File 'lib/govspeak/post_processor.rb', line 95 def output document = nokogiri_document self.class.extensions.each do |_, block| instance_exec(document, &block) end document.to_html end |