123456789_123456789_123456789_123456789_123456789_

Class: Gem::Dependency

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: lib/bundler/rubygems_ext.rb,
lib/bundler/shared_helpers.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#all_sources (rw)

[ GitHub ]

  
# File 'lib/bundler/rubygems_ext.rb', line 139

attr_accessor :source, :groups, :all_sources

#groups (rw)

[ GitHub ]

  
# File 'lib/bundler/rubygems_ext.rb', line 139

attr_accessor :source, :groups, :all_sources

#source (rw)

[ GitHub ]

  
# File 'lib/bundler/rubygems_ext.rb', line 139

attr_accessor :source, :groups, :all_sources

Instance Method Details

#encode_with(coder)

[ GitHub ]

  
# File 'lib/bundler/rubygems_ext.rb', line 143

def encode_with(coder)
  to_yaml_properties.each do |ivar|
    coder[ivar.to_s.sub(/^@/, "")] = instance_variable_get(ivar)
  end
end

#eql?

[ GitHub ]

  
# File 'lib/bundler/rubygems_ext.rb', line 141

alias_method :eql?, :==

#matches_spec?(spec) ⇒ Boolean

Backport of performance enhancement added to RubyGems 1.4

[ GitHub ]

  
# File 'lib/bundler/rubygems_ext.rb', line 163

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

[ GitHub ]

  
# File 'lib/bundler/shared_helpers.rb', line 17

def requirement
  version_requirements
end

#to_lock

[ GitHub ]

  
# File 'lib/bundler/rubygems_ext.rb', line 153

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

[ GitHub ]

  
# File 'lib/bundler/rubygems_ext.rb', line 149

def to_yaml_properties
  instance_variables.reject {|p| ["@source", "@groups", "@all_sources"].include?(p.to_s) }
end