class Fig::Statement::Configuration

A grouping of statements within a package. May not be nested.

Any processing of statements is guaranteed to hit any Overrides first.

Attributes

name[R]
statements[R]

Public Class Methods

new(line_column, source_description, name, statements) click to toggle source
Calls superclass method Fig::Statement::new
# File lib/fig/statement/configuration.rb, line 15
def initialize(line_column, source_description, name, statements)
  super(line_column, source_description)

  @name = name

  overrides, others = statements.partition do
    |statement| statement.is_a?(Fig::Statement::Override)
  end

  text = []
  if ! overrides.empty?
    text << Fig::Statement::SyntheticRawText.new(nil, nil, "\n")
  end

  @statements = [overrides, text, others].flatten
end

Public Instance Methods

command_statement() click to toggle source
# File lib/fig/statement/configuration.rb, line 36
def command_statement
  return statements.find do
    |statement| statement.is_a?(Fig::Statement::Command)
  end
end
deparse_as_version(deparser) click to toggle source
# File lib/fig/statement/configuration.rb, line 50
def deparse_as_version(deparser)
  return deparser.configuration(self)
end
minimum_grammar_for_emitting_input() click to toggle source
# File lib/fig/statement/configuration.rb, line 54
def minimum_grammar_for_emitting_input()
  return [0]
end
minimum_grammar_for_publishing() click to toggle source
# File lib/fig/statement/configuration.rb, line 58
def minimum_grammar_for_publishing()
  return [0]
end
statement_type() click to toggle source
# File lib/fig/statement/configuration.rb, line 32
def statement_type()
  return 'config'
end
walk_statements() { |statement| ... } click to toggle source

Block will receive a Statement.

# File lib/fig/statement/configuration.rb, line 43
def walk_statements(&block)
  @statements.each do |statement|
    yield statement
    statement.walk_statements(&block)
  end
end