Class: Gem::Dependency

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/resolver.rb,
lib/bundler/rubygems_ext.rb,
lib/bundler/shared_helpers.rb

Direct Known Subclasses

Bundler::Dependency

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) groups

Returns the value of attribute groups



107
108
109
# File 'lib/bundler/rubygems_ext.rb', line 107

def groups
  @groups
end

- (Object) source

Returns the value of attribute source



107
108
109
# File 'lib/bundler/rubygems_ext.rb', line 107

def source
  @source
end

Instance Method Details

- (Object) encode_with(coder)



111
112
113
114
115
# File 'lib/bundler/rubygems_ext.rb', line 111

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

- (Boolean) matches_spec?(spec)



131
132
133
134
135
136
137
# File 'lib/bundler/rubygems_ext.rb', line 131

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

- (Object) required_by



16
17
18
# File 'lib/bundler/resolver.rb', line 16

def required_by
  @required_by ||= []
end

- (Object) requirement



11
12
13
# File 'lib/bundler/shared_helpers.rb', line 11

def requirement
  version_requirements
end

- (Object) to_lock



121
122
123
124
125
126
127
128
# File 'lib/bundler/rubygems_ext.rb', line 121

def to_lock
  out = "  #{name}"
  unless requirement == Gem::Requirement.default
    reqs = requirement.requirements.map{|o,v| "#{o} #{v}" }.sort.reverse
    out << " (#{reqs.join(', ')})"
  end
  out
end

- (Object) to_yaml_properties



117
118
119
# File 'lib/bundler/rubygems_ext.rb', line 117

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