Class: Bolt::ModuleInstaller::Puppetfile::ForgeModule
- Defined in:
- lib/bolt/module_installer/puppetfile/forge_module.rb
Instance Attribute Summary collapse
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Attributes inherited from Module
Instance Method Summary collapse
-
#initialize(name, version) ⇒ ForgeModule
constructor
A new instance of ForgeModule.
-
#to_hash ⇒ Object
Returns a hash that can be used to create a module specification.
-
#to_spec ⇒ Object
Returns a Puppetfile module specification.
Constructor Details
#initialize(name, version) ⇒ ForgeModule
Returns a new instance of ForgeModule.
14 15 16 17 18 |
# File 'lib/bolt/module_installer/puppetfile/forge_module.rb', line 14 def initialize(name, version) super(name) @version = parse_version(version) @type = :forge end |
Instance Attribute Details
#version ⇒ Object (readonly)
Returns the value of attribute version.
12 13 14 |
# File 'lib/bolt/module_installer/puppetfile/forge_module.rb', line 12 def version @version end |
Instance Method Details
#to_hash ⇒ Object
Returns a hash that can be used to create a module specification.
45 46 47 48 49 50 |
# File 'lib/bolt/module_installer/puppetfile/forge_module.rb', line 45 def to_hash { 'name' => @full_name, 'version_requirement' => @version ? @version.to_s : nil }.compact end |
#to_spec ⇒ Object
Returns a Puppetfile module specification.
35 36 37 38 39 40 41 |
# File 'lib/bolt/module_installer/puppetfile/forge_module.rb', line 35 def to_spec if @version "mod '#{@full_name}', '#{@version}'" else "mod '#{@full_name}'" end end |