class Fig::Deparser::V2
Handles serializing of statements in the v2 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/v2.rb, line 14 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
grammar_description()
click to toggle source
# File lib/fig/deparser/v2.rb, line 54 def grammar_description() return 'v2' end
grammar_version(statement)
click to toggle source
# File lib/fig/deparser/v2.rb, line 27 def grammar_version(statement) add_indent @text << "grammar v2\n\n" return end
include_file(statement)
click to toggle source
# File lib/fig/deparser/v2.rb, line 35 def include_file(statement) path = statement.path quote = (path.include?(%q<'>) && ! path.include?(%q<">)) ? %q<"> : %q<'> add_indent @text << 'include-file ' @text << quote @text << path.gsub('\\', ('\\' * 4)).gsub(quote, "\\\\#{quote}") @text << quote if ! statement.config_name.nil? @text << ':' @text << statement.config_name end @text << "\n" return end