class PuppetfileResolver::Puppetfile::BaseModule
Attributes
location[RW]
The location of the module instantiation in the Puppetfile
document
module_type[R]
name[RW]
The name of the module
owner[RW]
The owner of the module
resolver_flags[RW]
Array of flags that will instruct the resolver to change its default behaviour. Current flags are set out in the PuppetfileResolver::Puppetfile::…_FLAG constants @api private @return [Array] Array of flags that will instruct the resolver to change its default behaviour
title[RW]
The full title of the module
version[RW]
The version of the module
Public Class Methods
new(title)
click to toggle source
# File lib/puppetfile-resolver/puppetfile/base_module.rb, line 36 def initialize(title) @title = title unless title.nil? # rubocop:disable Style/IfUnlessModifier @owner, @name = parse_title(@title) end @location = DocumentLocation.new @resolver_flags = [] end
Public Instance Methods
to_s()
click to toggle source
# File lib/puppetfile-resolver/puppetfile/base_module.rb, line 45 def to_s "#{self.class} #{title}-#{name}" end
Private Instance Methods
parse_title(title)
click to toggle source
# File lib/puppetfile-resolver/puppetfile/base_module.rb, line 51 def parse_title(title) if (match = title.match(/\A(\w+)\Z/)) [nil, match[1]] elsif (match = title.match(/\A(\w+)[-\/](\w+)\Z/)) [match[1], match[2]] else raise ArgumentError, format("Module name (%<title>s) must match either 'modulename' or 'owner/modulename'", title: title) end end