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.


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

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


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

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


37
38
39
# File 'lib/fig/statement/resource.rb', line 37

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

#statement_typeObject


23
24
25
# File 'lib/fig/statement/resource.rb', line 23

def statement_type()
  return 'resource'
end