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

#location

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_for_emitting_input, #minimum_grammar_for_publishing, #requires_globbing?, #standard_asset_name, #urls

Methods inherited from Fig::Statement

#is_asset?, #is_environment_variable?, #minimum_grammar_for_emitting_input, #minimum_grammar_for_publishing, position_description, #position_string, #urls, #walk_statements

Constructor Details

#initialize(line_column, source_description, location, 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, location, glob_if_not_url)
  super(line_column, source_description)

  @location        = location
  @glob_if_not_url = glob_if_not_url
end

Instance Method Details

#asset_nameObject



25
26
27
28
29
30
31
32
33
# File 'lib/fig/statement/resource.rb', line 25

def asset_name()
  if Fig::URL.is_url?(location())
    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

#deparse_as_version(deparser) ⇒ Object



35
36
37
# File 'lib/fig/statement/resource.rb', line 35

def deparse_as_version(deparser)
  return deparser.resource(self)
end

#statement_typeObject



21
22
23
# File 'lib/fig/statement/resource.rb', line 21

def statement_type()
  return 'resource'
end