Module: Fig::Unparser
Defined Under Namespace
Instance Method Summary collapse
- #archive(statement) ⇒ Object
- #command(statement) ⇒ Object
- #configuration(configuration_statement) ⇒ Object
- #grammar_version(statement) ⇒ Object
- #include(statement) ⇒ Object
- #override(statement) ⇒ Object
- #path(statement) ⇒ Object
- #resource(statement) ⇒ Object
- #retrieve(statement) ⇒ Object
- #set(statement) ⇒ Object
- #unparse(statements) ⇒ Object
Instance Method Details
#archive(statement) ⇒ Object
17 18 19 20 21 |
# File 'lib/fig/unparser.rb', line 17 def archive(statement) asset 'archive', statement return end |
#command(statement) ⇒ Object
23 24 25 |
# File 'lib/fig/unparser.rb', line 23 def command(statement) raise NotImplementedError end |
#configuration(configuration_statement) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fig/unparser.rb', line 27 def configuration(configuration_statement) if ! @text.empty? @text << "\n" end add_indent @text << 'config ' @text << configuration_statement.name @text << "\n" @indent_level += 1 begin configuration_statement.statements.each do |statement| statement.unparse_as_version(self) end ensure @indent_level -= 1 end add_indent @text << "end\n" return end |
#grammar_version(statement) ⇒ Object
54 55 56 |
# File 'lib/fig/unparser.rb', line 54 def grammar_version(statement) raise NotImplementedError end |
#include(statement) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/fig/unparser.rb', line 58 def include(statement) add_indent @text << 'include ' @text << Fig::PackageDescriptor.format( statement.package_name, statement.version, statement.config_name ) @text << "\n" return end |
#override(statement) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/fig/unparser.rb', line 70 def override(statement) add_indent @text << 'override ' @text << Fig::PackageDescriptor.format( statement.package_name, statement.version, nil ) @text << "\n" return end |
#path(statement) ⇒ Object
82 83 84 85 86 |
# File 'lib/fig/unparser.rb', line 82 def path(statement) environment_variable(statement, 'append') return end |
#resource(statement) ⇒ Object
88 89 90 91 92 |
# File 'lib/fig/unparser.rb', line 88 def resource(statement) asset 'resource', statement return end |
#retrieve(statement) ⇒ Object
94 95 96 |
# File 'lib/fig/unparser.rb', line 94 def retrieve(statement) raise NotImplementedError end |
#set(statement) ⇒ Object
98 99 100 101 102 |
# File 'lib/fig/unparser.rb', line 98 def set(statement) environment_variable(statement, 'set') return end |
#unparse(statements) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fig/unparser.rb', line 4 def unparse(statements) @text = '' @indent_level = @initial_indent_level statements.each { |statement| statement.unparse_as_version(self) } text = @text @text = nil @indent_level = nil return text end |