Sha256: 8f0c5e33d22fa3938b21a01879542accbd6dc999a0ce93f35da16538513fa02a
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
module Ore class Dependency # The name of the dependency attr_reader :name # The required versions attr_reader :versions # # Creates a new dependency. # # @param [String] name # The name of the dependency. # # @param [Array<String>] versions # The required versions. # def initialize(name,*versions) @name = name @versions = versions end # # Parses a version string. # # @param [String] name # The name of the dependency. # # @param [String, nil] versions # The version string. # # @return [Dependency] # The parsed dependency. # def self.parse_versions(name,versions) versions = if versions.kind_of?(String) versions.strip.split(/,\s*/) else [] end return new(name,*versions) end # # Parses a dependencey string. # # @param [String] dependency # The dependencey string. # # @return [Dependency] # The parsed dependency. # def self.parse(dependency) name, versions = dependency.strip.split(/\s+/,2) return parse_versions(name,versions) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ore-0.1.3 | lib/ore/dependency.rb |
ore-0.1.2 | lib/ore/dependency.rb |