class Fig::Statement::IncludeFile

Like an include, but of an unpublished file.

Constants

PATH_WITH_CONFIG_PATTERN

Attributes

config_name[R]
containing_package_descriptor[R]
path[R]

Public Class Methods

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

  @path                          = path
  @config_name                   = config_name
  @containing_package_descriptor = containing_package_descriptor
end
parse_path_with_config(path_with_config) { |'could not be understood as a path followed by a config name.'| ... } click to toggle source
# File lib/fig/statement/include_file.rb, line 11
def self.parse_path_with_config(path_with_config, &block)
  if match = PATH_WITH_CONFIG_PATTERN.match(path_with_config)
    return validate_and_process_raw_path_and_config_name(
      match[:path], match[:config], &block
    )
  end

  yield 'could not be understood as a path followed by a config name.'
  return
end
validate_and_process_raw_path_and_config_name( raw_path, config_name ) { |'has an unquoted colon (:) in the path portion.'| ... } click to toggle source
# File lib/fig/statement/include_file.rb, line 22
def self.validate_and_process_raw_path_and_config_name(
  raw_path, config_name, &block
)
  if raw_path !~ /['"]/ && raw_path =~ /:/
    yield 'has an unquoted colon (:) in the path portion.'
    return
  end
  if (
    ! config_name.nil? &&
    config_name !~ Fig::PackageDescriptor::COMPONENT_PATTERN
  )
    yield "contains an invalid config name (#{config_name})."
    return
  end
  tokenized_path = validate_and_process_escapes_in_path(raw_path, &block)
  return if tokenized_path.nil?

  return tokenized_path.to_expanded_string, config_name
end

Private Class Methods

validate_and_process_escapes_in_path(path, &block) click to toggle source
# File lib/fig/statement/include_file.rb, line 44
def self.validate_and_process_escapes_in_path(path, &block)
  return Fig::StringTokenizer.new.tokenize(path, &block)
end

Public Instance Methods

deparse_as_version(deparser) click to toggle source
# File lib/fig/statement/include_file.rb, line 77
def deparse_as_version(deparser)
  return deparser.include_file(self)
end
full_path_relative_to(including_package) click to toggle source
# File lib/fig/statement/include_file.rb, line 73
def full_path_relative_to(including_package)
  return File.expand_path(path, including_package.include_file_base_directory)
end
minimum_grammar_for_emitting_input() click to toggle source
# File lib/fig/statement/include_file.rb, line 81
def minimum_grammar_for_emitting_input()
  return [2, %q<didn't exist prior to v2>]
end
minimum_grammar_for_publishing() click to toggle source
# File lib/fig/statement/include_file.rb, line 85
def minimum_grammar_for_publishing()
  raise Fig::UserInputError.new 'Cannot publish an include-file statement.'
end
statement_type() click to toggle source
# File lib/fig/statement/include_file.rb, line 69
def statement_type()
  return 'include-file'
end