Module: Fig::Statement::Asset

Included in:
Archive, Resource
Defined in:
lib/fig/statement/asset.rb

Overview

Some sort of file to be included in a package.

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



10
11
12
# File 'lib/fig/statement/asset.rb', line 10

def location
  @location
end

Class Method Details

.included(class_included_into) ⇒ Object



12
13
14
15
16
# File 'lib/fig/statement/asset.rb', line 12

def self.included(class_included_into)
  class_included_into.extend(ClassMethods)

  return
end

Instance Method Details

#glob_if_not_url?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/fig/statement/asset.rb', line 18

def glob_if_not_url?()
  return @glob_if_not_url
end

#is_asset?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/fig/statement/asset.rb', line 26

def is_asset?()
  return true
end

#minimum_grammar_for_emitting_inputObject



46
47
48
# File 'lib/fig/statement/asset.rb', line 46

def minimum_grammar_for_emitting_input()
  return minimum_grammar_for_value location
end

#minimum_grammar_for_publishingObject



50
51
52
# File 'lib/fig/statement/asset.rb', line 50

def minimum_grammar_for_publishing()
  return minimum_grammar_for_value asset_name
end

#requires_globbing?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/fig/statement/asset.rb', line 30

def requires_globbing?()
  return glob_if_not_url? && ! Fig::URL.is_url?(location())
end

#standard_asset_nameObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fig/statement/asset.rb', line 34

def standard_asset_name()
  # Not so hot of an idea if the location is a URL and has query parameters
  # in it, but not going to fix this now.
  basename = location().split('/').last

  if Fig::URL.is_url? location
    return CGI.unescape basename
  end

  return basename
end

#urlsObject



22
23
24
# File 'lib/fig/statement/asset.rb', line 22

def urls()
  return [location()]
end