Class: LicenseFinder::CondaPackage::Identifier
- Inherits:
-
Object
- Object
- LicenseFinder::CondaPackage::Identifier
- Defined in:
- lib/license_finder/packages/conda_package.rb
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
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name, version) ⇒ Identifier
constructor
A new instance of Identifier.
- #to_s ⇒ Object
Constructor Details
#initialize(name, version) ⇒ Identifier
Returns a new instance of Identifier.
39 40 41 42 |
# File 'lib/license_finder/packages/conda_package.rb', line 39 def initialize(name, version) @name = name @version = version end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
37 38 39 |
# File 'lib/license_finder/packages/conda_package.rb', line 37 def name @name end |
#version ⇒ Object
Returns the value of attribute version.
37 38 39 |
# File 'lib/license_finder/packages/conda_package.rb', line 37 def version @version end |
Class Method Details
.from_hash(hash) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/license_finder/packages/conda_package.rb', line 44 def self.from_hash(hash) name = hash['name'] version = hash['version'] return nil if name.nil? || version.nil? Identifier.new(name, version) end |
Instance Method Details
#<=>(other) ⇒ Object
64 65 66 67 |
# File 'lib/license_finder/packages/conda_package.rb', line 64 def <=>(other) sort_name = @name <=> other.name sort_name.zero? ? @version <=> other.version : sort_name end |
#==(other) ⇒ Object
52 53 54 |
# File 'lib/license_finder/packages/conda_package.rb', line 52 def ==(other) other.is_a?(Identifier) && @name == other.name && @version == other.version end |
#eql?(other) ⇒ Boolean
56 57 58 |
# File 'lib/license_finder/packages/conda_package.rb', line 56 def eql?(other) self == other end |
#hash ⇒ Object
60 61 62 |
# File 'lib/license_finder/packages/conda_package.rb', line 60 def hash [@name, @version].hash end |
#to_s ⇒ Object
69 70 71 |
# File 'lib/license_finder/packages/conda_package.rb', line 69 def to_s "#{@name} - #{@version}" end |