class Gem::Dependency - bundler-1.15.4 Documentation

# class Gem::Dependency

### Attributes

groups[RW]
source[RW]

### Public Instance Methods

encode_with(coder) click to toggle source

    # File lib/bundler/rubygems_ext.rb, line 141
    def encode_with(coder)
      to_yaml_properties.each do |ivar|
        coder[ivar.to_s.sub(/^@/, "")] = instance_variable_get(ivar)
      end
    end

matches_spec?(spec) click to toggle source

Backport of performance enhancement added to Rubygems 1.4

    # File lib/bundler/rubygems_ext.rb, line 161
    def matches_spec?(spec)
      # name can be a Regexp, so use ===
      return false unless name === spec.name
      return true  if requirement.none?

      requirement.satisfied_by?(spec.version)
    end

requirement() click to toggle source

    # File lib/bundler/shared_helpers.rb, line 12
    def requirement
      version_requirements
    end

to_lock() click to toggle source

    # File lib/bundler/rubygems_ext.rb, line 151
    def to_lock
      out = String.new("  #{name}")
      unless requirement.none?
        reqs = requirement.requirements.map {|o, v| "#{o} #{v}" }.sort.reverse
        out << " (#{reqs.join(", ")})"
      end
      out
    end

to_yaml_properties() click to toggle source

    # File lib/bundler/rubygems_ext.rb, line 147
    def to_yaml_properties
      instance_variables.reject {|p| ["@source", "@groups"].include?(p.to_s) }
    end