Sha256: a9ff2c76d9eafd289314ae6a454ea02677f88f5cad93c6bdd5c013a8402365ba
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
module Ore # # Represents a RubyGem dependency. # 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, Array, nil] versions # The version(s). # # @return [Dependency] # The parsed dependency. # def self.parse_versions(name,versions) versions = case versions when String versions.strip.split(/,\s*/) when Array versions.map { |v| v.to_s } else [] end return new(name,*versions) end # # Parses a dependency string. # # @param [String] dependency # The dependency 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ore-core-0.1.2 | lib/ore/dependency.rb |