Class: Texter::RunPreprocessorsOnText
- Inherits:
-
Object
- Object
- Texter::RunPreprocessorsOnText
- Includes:
- CallableClass
- Defined in:
- app/lib/texter/run_preprocessors_on_text.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(text, options = {}) ⇒ RunPreprocessorsOnText
constructor
A new instance of RunPreprocessorsOnText.
Constructor Details
#initialize(text, options = {}) ⇒ RunPreprocessorsOnText
Returns a new instance of RunPreprocessorsOnText.
9 10 11 12 |
# File 'app/lib/texter/run_preprocessors_on_text.rb', line 9 def initialize(text, = {}) @text = text @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'app/lib/texter/run_preprocessors_on_text.rb', line 5 def @options end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'app/lib/texter/run_preprocessors_on_text.rb', line 5 def text @text end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/lib/texter/run_preprocessors_on_text.rb', line 14 def call attributes.each do |attr| body = text.send(attr) processed = Texter.preprocessors.inject(body) { |memo, preprocessor| Texter.find_preprocessor(preprocessor).call(memo) } text.send "#{attr}=", processed end end |