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.



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

def location
  @location
end

Class Method Details

.included(class_included_into) ⇒ Object



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

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

  return
end

Instance Method Details

#glob_if_not_url?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/fig/statement/asset.rb', line 20

def glob_if_not_url?()
  return @glob_if_not_url
end

#is_asset?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/fig/statement/asset.rb', line 28

def is_asset?()
  return true
end

#minimum_grammar_for_emitting_inputObject



48
49
50
# File 'lib/fig/statement/asset.rb', line 48

def minimum_grammar_for_emitting_input()
  return minimum_grammar_for_value location
end

#minimum_grammar_for_publishingObject



52
53
54
# File 'lib/fig/statement/asset.rb', line 52

def minimum_grammar_for_publishing()
  return minimum_grammar_for_value asset_name
end

#requires_globbing?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/fig/statement/asset.rb', line 32

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

#standard_asset_nameObject



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

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



24
25
26
# File 'lib/fig/statement/asset.rb', line 24

def urls()
  return [location()]
end