Class: Fig::Deparser::V2
- Inherits:
-
Object
- Object
- Fig::Deparser::V2
- Includes:
- Fig::Deparser, V1Base
- Defined in:
- lib/fig/deparser/v2.rb
Overview
Handles serializing of statements in the v2 grammar.
Instance Method Summary collapse
- #grammar_description ⇒ Object
- #grammar_version(statement) ⇒ Object
- #include_file(statement) ⇒ Object
-
#initialize(emit_as_input_or_to_be_published_values, indent_string = ' ' * 2, initial_indent_level = 0) ⇒ V2
constructor
A new instance of V2.
Methods included from V1Base
Methods included from Fig::Deparser
#archive, class_for_statements, #command, #configuration, #deparse, determine_version_and_deparse, #include, #override, #path, #resource, #retrieve, #set, #synthetic_raw_text
Constructor Details
#initialize(emit_as_input_or_to_be_published_values, indent_string = ' ' * 2, initial_indent_level = 0) ⇒ V2
Returns a new instance of V2.
14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 |
Instance Method Details
#grammar_description ⇒ Object
54 55 56 |
# File 'lib/fig/deparser/v2.rb', line 54 def grammar_description() return 'v2' end |
#grammar_version(statement) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/fig/deparser/v2.rb', line 27 def grammar_version(statement) add_indent @text << "grammar v2\n\n" return end |
#include_file(statement) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# 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 |