Class: Fig::Statement::Resource

Inherits:
Fig::Statement show all
Includes:
Asset
Defined in:
lib/fig/statement/resource.rb

Overview

Specifies a file (possibly via a URL) that is part of the current package.

Differs from an Archive in that the contents will not be extracted.

Constant Summary

Constants inherited from Fig::Statement

ENVIRONMENT_VARIABLE_NAME_REGEX

Instance Attribute Summary

Attributes included from Asset

#url

Attributes inherited from Fig::Statement

#column, #line, #source_description

Instance Method Summary collapse

Methods included from Asset

#glob_if_not_url?, included, #is_asset?, #minimum_grammar_version_required, #requires_globbing?, #standard_asset_name, #urls

Methods inherited from Fig::Statement

#is_asset?, #is_environment_variable?, #minimum_grammar_version_required, position_description, #position_string, strip_quotes_and_process_escapes!, #urls, #walk_statements

Constructor Details

#initialize(line_column, source_description, url, glob_if_not_url) ⇒ Resource

Returns a new instance of Resource.



14
15
16
17
18
19
# File 'lib/fig/statement/resource.rb', line 14

def initialize(line_column, source_description, url, glob_if_not_url)
  super(line_column, source_description)

  @url             = url
  @glob_if_not_url = glob_if_not_url
end

Instance Method Details

#asset_nameObject



21
22
23
24
25
26
27
28
29
# File 'lib/fig/statement/resource.rb', line 21

def asset_name()
  if Fig::URL.is_url?(url())
    return standard_asset_name()
  end

  # This resource will end up being bundled with others and will not live in
  # the package by itself.
  return nil
end

#unparse_as_version(unparser) ⇒ Object



31
32
33
# File 'lib/fig/statement/resource.rb', line 31

def unparse_as_version(unparser)
  return unparser.resource(self)
end