Sha256: 3022ec2ebe81de996123a5788df036500cacc0f1a4f479a009a8cb87152b1e29
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
module Indexer # The Conflict class models the name and versions of # packages that have know incompatibilities. # class Conflict < Model # Parse `data` into a Dependency instance. # # TODO: What about respond_to?(:to_str) for String, etc. def self.parse(data) case data when String parse_string(data) when Array parse_array(data) when Hash parse_hash(data) else raise(ValidationError, "Conflict") end end private # # def self.parse_string(data) name, version = data.split(/\s+/) new(:name=>name, :version=>version) end # # def self.parse_array(data) name, version = *data new(:name=>name, :version=>version) end # # def self.parse_hash(data) new(data) end public # # The name of the package that causes the conflict. # # Yea it's *ALWAYS* THEIR fault ;-) # attr :name # # Set the name of the package. # def name=(name) @data[:name] = name.to_s end # # The versions constraint of the conflicting package. # This is used when only certain versions of the package # are the problem. # attr_reader :version # # Set the version constraint. # def version=(version) @data[:version] = Version::Constraint.parse(version) end # # # def to_h {'name'=>name, 'version'=>version.to_s} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
indexer-0.3.1 | lib/indexer/components/conflict.rb |
indexer-0.3.0 | lib/indexer/components/conflict.rb |
indexer-0.2.0 | lib/indexer/components/conflict.rb |