Class: Puppet::Module::Tool::Dependency
- Inherits:
-
Object
- Object
- Puppet::Module::Tool::Dependency
- Defined in:
- lib/puppet/module/tool/dependency.rb
Instance Method Summary collapse
-
#initialize(full_name, version_requirement = nil, repository = nil) ⇒ Dependency
constructor
Instantiates a new module dependency with a
full_name
(e.g. “myuser-mymodule”), and optionalversion_requirement
(e.g. “0.0.1”) and optional repository (a URL string). -
#to_pson(*args) ⇒ Object
Return PSON representation of this data.
Constructor Details
#initialize(full_name, version_requirement = nil, repository = nil) ⇒ Dependency
Instantiates a new module dependency with a full_name
(e.g. “myuser-mymodule”), and optional version_requirement
(e.g. “0.0.1”) and optional repository (a URL string).
8 9 10 11 12 13 14 |
# File 'lib/puppet/module/tool/dependency.rb', line 8 def initialize(full_name, version_requirement = nil, repository = nil) @full_name = full_name # TODO: add error checking, the next line raises ArgumentError when +full_name+ is invalid @username, @name = Puppet::Module::Tool.username_and_modname_from(full_name) @version_requirement = version_requirement @repository = repository ? Repository.new(repository) : nil end |
Instance Method Details
#to_pson(*args) ⇒ Object
Return PSON representation of this data.
17 18 19 20 21 22 |
# File 'lib/puppet/module/tool/dependency.rb', line 17 def to_pson(*args) result = { :name => @full_name } result[:version_requirement] = @version_requirement if @version_requirement && ! @version_requirement.nil? result[:repository] = @repository.to_s if @repository && ! @repository.nil? result.to_pson(*args) end |