Class: Staticz::Compilable::Haml
- Inherits:
-
Object
- Object
- Staticz::Compilable::Haml
- Includes:
- Staticz::Compilable
- Defined in:
- lib/manifest/compilable/haml.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #build(listener_class: nil) ⇒ Object
- #errors ⇒ Object
-
#initialize(name) ⇒ Haml
constructor
A new instance of Haml.
Methods included from Staticz::Compilable
#build_path, #create_link_function, #exists?, included, #path, #path_method_name, #print, #source_path, #valid?, #warnings
Constructor Details
#initialize(name) ⇒ Haml
Returns a new instance of Haml.
13 14 15 |
# File 'lib/manifest/compilable/haml.rb', line 13 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/manifest/compilable/haml.rb', line 9 def name @name end |
Instance Method Details
#build(listener_class: nil) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/manifest/compilable/haml.rb', line 32 def build(listener_class: nil) listener = listener_class&.new(self) if valid? engine = ::Haml::Engine.new(File.read(source_path)) File.write build_path, engine.render listener&.finish else listener&.error end end |
#errors ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/manifest/compilable/haml.rb', line 17 def errors errors = super if exists? begin engine = ::Haml::Engine.new(File.read(source_path)) engine.render rescue => e errors << e. end end errors end |