Class: Dockerize::TemplateParser
- Inherits:
-
Object
- Object
- Dockerize::TemplateParser
- Defined in:
- lib/dockerize/template_parser.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#raw_text ⇒ Object
readonly
Returns the value of attribute raw_text.
Instance Method Summary collapse
- #document_name ⇒ Object
- #executable? ⇒ Boolean
-
#initialize(contents) ⇒ TemplateParser
constructor
A new instance of TemplateParser.
- #parsed_erb ⇒ Object
- #write_with(writer) ⇒ Object
Constructor Details
#initialize(contents) ⇒ TemplateParser
Returns a new instance of TemplateParser.
11 12 13 14 |
# File 'lib/dockerize/template_parser.rb', line 11 def initialize(contents) @raw_text = contents = [] end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
9 10 11 |
# File 'lib/dockerize/template_parser.rb', line 9 def end |
#raw_text ⇒ Object (readonly)
Returns the value of attribute raw_text.
8 9 10 |
# File 'lib/dockerize/template_parser.rb', line 8 def raw_text @raw_text end |
Instance Method Details
#document_name ⇒ Object
16 17 18 |
# File 'lib/dockerize/template_parser.rb', line 16 def document_name [:filename] end |
#executable? ⇒ Boolean
20 21 22 |
# File 'lib/dockerize/template_parser.rb', line 20 def executable? [:executable] == true ? true : false end |
#parsed_erb ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/dockerize/template_parser.rb', line 30 def parsed_erb return @parsed_erb if @parsed_erb begin @parsed_erb = parse_erb(raw_text, config_vars) rescue SyntaxError @parsed_erb = nil end end |
#write_with(writer) ⇒ Object
24 25 26 27 28 |
# File 'lib/dockerize/template_parser.rb', line 24 def write_with(writer) text = parsed_erb writer.document_name = document_name writer.write(text, executable?) end |