Class: Fig::Package::Include

Inherits:
Object
  • Object
show all
Includes:
Statement
Defined in:
lib/fig/package/include.rb

Overview

Dual role: “include :configname” incorporates one configuration into another; “include package” declares a dependency upon another package.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Statement

#urls, #walk_statements

Constructor Details

#initialize(package_name, config_name, version_name, overrides) ⇒ Include

Returns a new instance of Include.



15
16
17
18
19
20
# File 'lib/fig/package/include.rb', line 15

def initialize(package_name, config_name, version_name, overrides)
  @package_name = package_name
  @config_name = config_name
  @version_name = version_name
  @overrides = overrides
end

Instance Attribute Details

#config_nameObject (readonly)

Returns the value of attribute config_name.



13
14
15
# File 'lib/fig/package/include.rb', line 13

def config_name
  @config_name
end

#overridesObject (readonly)

Returns the value of attribute overrides.



13
14
15
# File 'lib/fig/package/include.rb', line 13

def overrides
  @overrides
end

#package_nameObject (readonly)

Returns the value of attribute package_name.



13
14
15
# File 'lib/fig/package/include.rb', line 13

def package_name
  @package_name
end

#version_nameObject (readonly)

Returns the value of attribute version_name.



13
14
15
# File 'lib/fig/package/include.rb', line 13

def version_name
  @version_name
end

Instance Method Details

#unparse(indent) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/fig/package/include.rb', line 22

def unparse(indent)
  descriptor = ''
  descriptor += @package_name if @package_name
  descriptor += "/#{@version_name}" if @version_name
  descriptor += ":#{@config_name}" if @config_name
  @overrides.each do |override|
    descriptor += override.unparse
  end
  return "#{indent}include #{descriptor}"
end