Class: Phlexing::ERBTransformer

Inherits:
Object
  • Object
show all
Defined in:
lib/phlexing/erb_transformer.rb

Overview

Takes ERB and transforms it to Nokogiri-compatible HTML.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ ERBTransformer

Returns a new instance of ERBTransformer.



12
13
14
# File 'lib/phlexing/erb_transformer.rb', line 12

def initialize(source)
  @source = source.to_s.dup
end

Class Method Details

.callObject



8
9
10
# File 'lib/phlexing/erb_transformer.rb', line 8

def self.call(...)
  new(...).call
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
# File 'lib/phlexing/erb_transformer.rb', line 16

def call
  remove_newlines
  strip_whitespace
  transform_erb_tags
  transform_template_tags

  @source
end