Class: Fig::Unparser::V0

Inherits:
Object
  • Object
show all
Includes:
Fig::Unparser
Defined in:
lib/fig/unparser/v0.rb

Overview

Handles serializing of statements in the v0 grammar.

Instance Method Summary collapse

Methods included from Fig::Unparser

#archive, #configuration, #include, #override, #path, #resource, #set, #unparse

Constructor Details

#initialize(emit_as_input_or_to_be_published_values, indent_string = ' ' * 2, initial_indent_level = 0) ⇒ V0

Returns a new instance of V0.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fig/unparser/v0.rb', line 11

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

#command(statement) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/fig/unparser/v0.rb', line 24

def command(statement)
  add_indent

  @text << %q<command ">
  @text << statement.command
  @text << %Q<"\n>

  return
end

#grammar_version(statement) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/fig/unparser/v0.rb', line 34

def grammar_version(statement)
  add_indent

  # Comment out so that older clients don't have issues.
  @text << "# grammar v0\n"

  return
end

#retrieve(statement) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fig/unparser/v0.rb', line 43

def retrieve(statement)
  add_indent

  @text << 'retrieve '
  @text << statement.var
  @text << '->'
  @text << statement.path
  @text << "\n"

  return
end