class Berkshelf::Lockfile::Graph::GraphItem

A single item inside the graph.

Attributes

dependencies[R]

The list of dependencies and their constraints.

@return [Hash<String, String>]

the list of dependencies for this graph item, where the key
corresponds to the name of the dependency and the value is the
version constraint.
name[R]

The name of the cookbook that corresponds to this graph item.

@return [String]

the name of the cookbook
version[R]

The locked version for this graph item.

@return [String]

the locked version of the graph item (as a string)

Public Class Methods

new(name, version, dependencies = {}) click to toggle source

Create a new graph item.

# File lib/berkshelf/lockfile.rb, line 838
def initialize(name, version, dependencies = {})
  @name         = name.to_s
  @version      = version.to_s
  @dependencies = dependencies
end

Public Instance Methods

add_dependency(name, constraint) click to toggle source

Add a new dependency to the list.

@param [#to_s] name

the name to use

@param [#to_s] constraint

the version constraint to use
# File lib/berkshelf/lockfile.rb, line 850
def add_dependency(name, constraint)
  @dependencies[name.to_s] = constraint.to_s
end
set_dependencies(dependencies) click to toggle source
# File lib/berkshelf/lockfile.rb, line 854
def set_dependencies(dependencies)
  @dependencies = dependencies.to_hash
end
to_s() click to toggle source

@private

# File lib/berkshelf/lockfile.rb, line 859
def to_s
  "#{name} (#{version})"
end