Class: Phlexing::Converter
- Inherits:
-
Object
- Object
- Phlexing::Converter
- Defined in:
- lib/phlexing/converter.rb
Instance Attribute Summary collapse
-
#custom_elements ⇒ Object
Returns the value of attribute custom_elements.
-
#options ⇒ Object
Returns the value of attribute options.
-
#source ⇒ Object
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
- #call(source) ⇒ Object
- #code ⇒ Object
- #component_code ⇒ Object
-
#initialize(source = nil, **options) ⇒ Converter
constructor
A new instance of Converter.
-
#template_code ⇒ Object
private.
Constructor Details
Instance Attribute Details
#custom_elements ⇒ Object
Returns the value of attribute custom_elements.
5 6 7 |
# File 'lib/phlexing/converter.rb', line 5 def custom_elements @custom_elements end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/phlexing/converter.rb', line 5 def @options end |
#source ⇒ Object
Returns the value of attribute source.
5 6 7 |
# File 'lib/phlexing/converter.rb', line 5 def source @source end |
Class Method Details
.call(source, **options) ⇒ Object
7 8 9 |
# File 'lib/phlexing/converter.rb', line 7 def self.call(source, **) new(**).call(source) end |
.convert(source, **options) ⇒ Object
11 12 13 |
# File 'lib/phlexing/converter.rb', line 11 def self.convert(source, **) new(**).call(source) end |
Instance Method Details
#call(source) ⇒ Object
15 16 17 18 19 |
# File 'lib/phlexing/converter.rb', line 15 def call(source) @source = source code end |
#code ⇒ Object
28 29 30 |
# File 'lib/phlexing/converter.rb', line 28 def code .component? ? component_code : template_code end |
#component_code ⇒ Object
38 39 40 |
# File 'lib/phlexing/converter.rb', line 38 def component_code ComponentGenerator.call(self) end |
#template_code ⇒ Object
private
34 35 36 |
# File 'lib/phlexing/converter.rb', line 34 def template_code TemplateGenerator.call(self, source) end |