Class: Fig::Statement::Override

Inherits:
Fig::Statement show all
Defined in:
lib/fig/statement/override.rb

Overview

Overrides one package version dependency with another.

config whatever
  override somedependency/3.2.6
end

indicates that, regardless of which version of somedependency the blah package says it needs, the blah package will actually use v3.2.6.

Constant Summary

Constants inherited from Fig::Statement

ENVIRONMENT_VARIABLE_NAME_REGEX

Instance Attribute Summary collapse

Attributes inherited from Fig::Statement

#column, #line, #source_description

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Fig::Statement

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

Constructor Details

#initialize(line_column, source_description, package_name, version) ⇒ Override

Returns a new instance of Override.



31
32
33
34
35
36
# File 'lib/fig/statement/override.rb', line 31

def initialize(line_column, source_description, package_name, version)
  super(line_column, source_description)

  @package_name = package_name
  @version = version
end

Instance Attribute Details

#package_nameObject (readonly)

Returns the value of attribute package_name.



17
18
19
# File 'lib/fig/statement/override.rb', line 17

def package_name
  @package_name
end

#versionObject (readonly)

Returns the value of attribute version.



17
18
19
# File 'lib/fig/statement/override.rb', line 17

def version
  @version
end

Class Method Details

.parse_descriptor(raw_string, options = {}) ⇒ Object

Centralized definition of requirements for descriptors for override statements.



21
22
23
24
25
26
27
28
29
# File 'lib/fig/statement/override.rb', line 21

def self.parse_descriptor(raw_string, options = {})
  filled_in_options = {}
  filled_in_options.merge!(options)
  filled_in_options[:name]    = :required
  filled_in_options[:version] = :required
  filled_in_options[:config]  = :forbidden

  return Fig::PackageDescriptor.parse(raw_string, filled_in_options)
end

Instance Method Details

#deparse_as_version(deparser) ⇒ Object



42
43
44
# File 'lib/fig/statement/override.rb', line 42

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

#minimum_grammar_for_emitting_inputObject



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

def minimum_grammar_for_emitting_input()
  return [0]
end

#minimum_grammar_for_publishingObject



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

def minimum_grammar_for_publishing()
  return [0]
end

#statement_typeObject



38
39
40
# File 'lib/fig/statement/override.rb', line 38

def statement_type()
  return 'override'
end