Sha256: f8969f3d11c63b67356c836f7cfbc20469629bc165a2d41641cf899cfed8380b

Contents?: true

Size: 1.11 KB

Versions: 26

Compression:

Stored size: 1.11 KB

Contents

require 'fig/deparser'
require 'fig/deparser/v1_base'

module Fig; end
module Fig::Deparser; end

# Handles serializing of statements in the v2 grammar.
class Fig::Deparser::V2
  include Fig::Deparser
  include Fig::Deparser::V1Base

  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

  def grammar_version(statement)
    add_indent

    @text << "grammar v2\n"

    return
  end

  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

  def grammar_description()
    return 'v2'
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
fig-1.23.0 lib/fig/deparser/v2.rb
fig-1.22.1.beta.1 lib/fig/deparser/v2.rb
fig-1.22.0 lib/fig/deparser/v2.rb
fig-1.21.1.beta.2 lib/fig/deparser/v2.rb
fig-1.21.1.beta.1 lib/fig/deparser/v2.rb
fig-1.21.0 lib/fig/deparser/v2.rb
fig-1.20.1.beta.1 lib/fig/deparser/v2.rb
fig-1.20.0 lib/fig/deparser/v2.rb
fig-1.19.0 lib/fig/deparser/v2.rb
fig-1.18.0 lib/fig/deparser/v2.rb
fig-1.17.0 lib/fig/deparser/v2.rb
fig-1.16.1.beta.1 lib/fig/deparser/v2.rb
fig-1.16.0 lib/fig/deparser/v2.rb
fig-1.15.1.beta.2 lib/fig/deparser/v2.rb
fig-1.15.1.beta.1 lib/fig/deparser/v2.rb
fig-1.15.0 lib/fig/deparser/v2.rb
fig-1.14.0 lib/fig/deparser/v2.rb
fig-1.13.0 lib/fig/deparser/v2.rb
fig-1.12.0 lib/fig/deparser/v2.rb
fig-1.11.0 lib/fig/deparser/v2.rb