Class: ChefCLI::Policyfile::SolutionDependencies::Cookbook
- Inherits:
-
Struct
- Object
- Struct
- ChefCLI::Policyfile::SolutionDependencies::Cookbook
- Defined in:
- lib/chef-cli/policyfile/solution_dependencies.rb,
lib/chef-cli/policyfile/solution_dependencies.rb
Constant Summary collapse
- VALID_STRING_FORMAT =
/\A[^\s]+ \([^\s]+\)\Z/
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
27 28 29 |
# File 'lib/chef-cli/policyfile/solution_dependencies.rb', line 27 def name @name end |
#version ⇒ Object
Returns the value of attribute version
27 28 29 |
# File 'lib/chef-cli/policyfile/solution_dependencies.rb', line 27 def version @version end |
Class Method Details
.parse(str) ⇒ Object
37 38 39 40 41 |
# File 'lib/chef-cli/policyfile/solution_dependencies.rb', line 37 def self.parse(str) name, version_w_parens = str.split(" ") version = version_w_parens[/\(([^)]+)\)/, 1] new(name, version) end |
.valid_str?(str) ⇒ Boolean
33 34 35 |
# File 'lib/chef-cli/policyfile/solution_dependencies.rb', line 33 def self.valid_str?(str) !!(str =~ VALID_STRING_FORMAT) end |
Instance Method Details
#eql?(other) ⇒ Boolean
47 48 49 50 51 |
# File 'lib/chef-cli/policyfile/solution_dependencies.rb', line 47 def eql?(other) other.is_a?(self.class) && other.name == name && other.version == version end |
#hash ⇒ Object
53 54 55 |
# File 'lib/chef-cli/policyfile/solution_dependencies.rb', line 53 def hash [name, version].hash end |
#to_s ⇒ Object
43 44 45 |
# File 'lib/chef-cli/policyfile/solution_dependencies.rb', line 43 def to_s "#{name} (#{version})" end |