class Fig::Deparser::V0
Handles serializing of statements in the v0 grammar.
Public Class Methods
new( emit_as_input_or_to_be_published_values, indent_string = ' ' * 2, initial_indent_level = 0 )
click to toggle source
# File lib/fig/deparser/v0.rb, line 12 def initialize( emit_as_input_or_to_be_published_values, indent_string = ' ' * 2, initial_indent_level = 0 ) @emit_as_input_or_to_be_published_values = emit_as_input_or_to_be_published_values @indent_string = indent_string @initial_indent_level = initial_indent_level return end
Public Instance Methods
command(statement)
click to toggle source
# File lib/fig/deparser/v0.rb, line 25 def command(statement) add_indent @text << %q<command "> @text << statement.command.first.to_double_quotable_string @text << %Q<"\n> return end
grammar_description()
click to toggle source
# File lib/fig/deparser/v0.rb, line 56 def grammar_description() return 'v0' end
grammar_version(statement)
click to toggle source
# File lib/fig/deparser/v0.rb, line 35 def grammar_version(statement) add_indent # Comment out so that older clients don't have issues. @text << "# grammar v0\n\n" return end
retrieve(statement)
click to toggle source
# File lib/fig/deparser/v0.rb, line 44 def retrieve(statement) add_indent @text << 'retrieve ' @text << statement.variable @text << '->' @text << statement.tokenized_path.to_double_quotable_string @text << "\n" return end
Private Instance Methods
asset(keyword, statement)
click to toggle source
# File lib/fig/deparser/v0.rb, line 62 def asset(keyword, statement) path = asset_path statement quote = path =~ /[*?\[\]{}]/ ? '' : %q<"> add_indent @text << keyword @text << ' ' @text << quote @text << path @text << quote @text << "\n" return end
environment_variable(statement, keyword)
click to toggle source
# File lib/fig/deparser/v0.rb, line 77 def environment_variable(statement, keyword) add_indent @text << keyword @text << ' ' @text << statement.name @text << '=' @text << statement.tokenized_value.to_double_quotable_string @text << "\n" return end