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 collapse

Attributes inherited from Fig::Statement

#column, #line, #source_description

Instance Method Summary collapse

Methods included from Asset

#is_asset?, #standard_asset_name, #urls

Methods inherited from Fig::Statement

#is_asset?, position_description, #position_string, #urls, #walk_statements

Constructor Details

#initialize(line_column, source_description, url) ⇒ Resource

Returns a new instance of Resource.



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

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

  @url = url
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



13
14
15
# File 'lib/fig/statement/resource.rb', line 13

def url
  @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::Repository.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(indent) ⇒ Object



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

def unparse(indent)
  "#{indent}resource #{url}"
end