Class: Ra10ke::Duplicates::Verification
- Inherits:
-
Object
- Object
- Ra10ke::Duplicates::Verification
- Includes:
- PuppetfileParser
- Defined in:
- lib/ra10ke/duplicates.rb
Defined Under Namespace
Classes: Module
Instance Attribute Summary collapse
-
#puppetfile ⇒ Object
readonly
Returns the value of attribute puppetfile.
Instance Method Summary collapse
- #duplicates ⇒ Object
-
#initialize(file) ⇒ Verification
constructor
A new instance of Verification.
Methods included from PuppetfileParser
#forge_modules, #git_modules, #modules, #parse_module_args, #process_args
Constructor Details
#initialize(file) ⇒ Verification
Returns a new instance of Verification.
65 66 67 68 69 |
# File 'lib/ra10ke/duplicates.rb', line 65 def initialize(file) file ||= './Puppetfile' @puppetfile = File.(file) abort("Puppetfile does not exist at #{puppetfile}") unless File.readable?(puppetfile) end |
Instance Attribute Details
#puppetfile ⇒ Object (readonly)
Returns the value of attribute puppetfile.
63 64 65 |
# File 'lib/ra10ke/duplicates.rb', line 63 def puppetfile @puppetfile end |
Instance Method Details
#duplicates ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/ra10ke/duplicates.rb', line 71 def duplicates to_ret = {} modules(puppetfile).each do |mod| (to_ret[mod[:name]] ||= []) << Module.new(mod[:namespace], mod[:name], mod[:args]) end to_ret.select { |_k, v| v.count > 1 } end |