class Fig::Statement::Command

Specifies a default command that will be executed for a given Configuration if no command is specified on the command-line.

Constants

TOKENIZING_SUBEXPRESSION_MATCHER

Attributes

command[R]

Public Class Methods

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

  @command = command
end
validate_and_process_escapes_in_argument( command_line_argument, &block ) click to toggle source
# File lib/fig/statement/command.rb, line 12
def self.validate_and_process_escapes_in_argument(
  command_line_argument, &block
)
  tokenizer = Fig::StringTokenizer.new TOKENIZING_SUBEXPRESSION_MATCHER, '@'

  return tokenizer.tokenize command_line_argument, &block
end

Public Instance Methods

deparse_as_version(deparser) click to toggle source
# File lib/fig/statement/command.rb, line 30
def deparse_as_version(deparser)
  return deparser.command(self)
end
minimum_grammar_for_emitting_input() click to toggle source
# File lib/fig/statement/command.rb, line 34
def minimum_grammar_for_emitting_input()
  return minimum_grammar()
end
minimum_grammar_for_publishing() click to toggle source
# File lib/fig/statement/command.rb, line 38
def minimum_grammar_for_publishing()
  return minimum_grammar()
end
statement_type() click to toggle source
# File lib/fig/statement/command.rb, line 26
def statement_type()
  return 'command'
end

Private Instance Methods

minimum_grammar() click to toggle source
# File lib/fig/statement/command.rb, line 44
def minimum_grammar()
  if command.size > 1
    return [1, 'contains multiple components']
  end

  argument = command.first.to_escaped_string

  # Can't have octothorpes anywhere in v0 due to comment stripping via
  # regex.
  if argument =~ /#/
    return [1, 'contains a comment ("#") character']
  end

  if argument =~ /"/
    return [1, %Q<contains a double quote>]
  end

  return [0]
end