Class: Germinate::TransformProcess
- Inherits:
-
Object
- Object
- Germinate::TransformProcess
- Defined in:
- lib/germinate/transform_process.rb
Instance Method Summary collapse
- #call(hunk) ⇒ Object
-
#ordered_transforms ⇒ Object
We can’t just use TextTransforms.singleton_methods because order is important.
Instance Method Details
#call(hunk) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/germinate/transform_process.rb', line 14 def call(hunk) ordered_transforms.inject(hunk) { |input, transform| if hunk.send("#{transform}?") log.debug "Performing text transform #{transform} on #{hunk}" Germinate::TextTransforms.send(transform).call(input) else log.debug "Skipping text transform #{transform} on #{hunk} lines" input end } end |
#ordered_transforms ⇒ Object
We can’t just use TextTransforms.singleton_methods because order is important
8 9 10 11 12 |
# File 'lib/germinate/transform_process.rb', line 8 def ordered_transforms %w[expand_insertions strip_blanks erase_comments uncomment join_lines rstrip_lines pipeline bracket flatten_nested] end |