# class Puppet::ModuleTool::Dependency

### Public Class Methods

new(full_module_name, version_requirement = nil, repository = nil) click to toggle source

Instantiates a new module dependency with a `full_module_name` (e.g. “myuser-mymodule”), and optional `version_requirement` (e.g. “0.0.1”) and optional repository (a URL string).

    # File lib/puppet/module_tool/dependency.rb, line 8
    def initialize(full_module_name, version_requirement = nil, repository = nil)
      @full_module_name = full_module_name
      # TODO: add error checking, the next line raises ArgumentError when +full_module_name+ is invalid
      @username, @name = Puppet::ModuleTool.username_and_modname_from(full_module_name)
      @version_requirement = version_requirement
      @repository = repository ? Puppet::Forge::Repository.new(repository) : nil
    end

### Public Instance Methods

to_pson(*args) click to toggle source

Return PSON representation of this data.

    # File lib/puppet/module_tool/dependency.rb, line 17
    def to_pson(*args)
      result = { :name => @full_module_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