Class: Berkshelf::Lockfile::Graph::GraphItem
- Inherits:
-
Object
- Object
- Berkshelf::Lockfile::Graph::GraphItem
- Defined in:
- lib/berkshelf/lockfile.rb
Overview
A single item inside the graph.
Instance Attribute Summary collapse
-
#dependencies ⇒ Hash<String, String>
readonly
The list of dependencies and their constraints.
-
#name ⇒ String
readonly
The name of the cookbook that corresponds to this graph item.
-
#version ⇒ String
readonly
The locked version for this graph item.
Instance Method Summary collapse
-
#add_dependency(name, constraint) ⇒ Object
Add a new dependency to the list.
-
#initialize(name, version, dependencies = {}) ⇒ GraphItem
constructor
Create a new graph item.
- #set_dependencies(dependencies) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, version, dependencies = {}) ⇒ GraphItem
Create a new graph item.
837 838 839 840 841 |
# File 'lib/berkshelf/lockfile.rb', line 837 def initialize(name, version, dependencies = {}) @name = name.to_s @version = version.to_s @dependencies = dependencies end |
Instance Attribute Details
#dependencies ⇒ Hash<String, String> (readonly)
The list of dependencies and their constraints.
834 835 836 |
# File 'lib/berkshelf/lockfile.rb', line 834 def dependencies @dependencies end |
#name ⇒ String (readonly)
The name of the cookbook that corresponds to this graph item.
820 821 822 |
# File 'lib/berkshelf/lockfile.rb', line 820 def name @name end |
#version ⇒ String (readonly)
The locked version for this graph item.
826 827 828 |
# File 'lib/berkshelf/lockfile.rb', line 826 def version @version end |
Instance Method Details
#add_dependency(name, constraint) ⇒ Object
Add a new dependency to the list.
849 850 851 |
# File 'lib/berkshelf/lockfile.rb', line 849 def add_dependency(name, constraint) @dependencies[name.to_s] = constraint.to_s end |
#set_dependencies(dependencies) ⇒ Object
853 854 855 |
# File 'lib/berkshelf/lockfile.rb', line 853 def set_dependencies(dependencies) @dependencies = dependencies.to_hash end |
#to_s ⇒ Object
858 859 860 |
# File 'lib/berkshelf/lockfile.rb', line 858 def to_s "#{name} (#{version})" end |