Class: Gem::Dependency

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

Direct Known Subclasses

Bundler::Dependency

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#groupsObject

Returns the value of attribute groups.



145
146
147
# File 'lib/bundler/rubygems_ext.rb', line 145

def groups
  @groups
end

#sourceObject

Returns the value of attribute source.



145
146
147
# File 'lib/bundler/rubygems_ext.rb', line 145

def source
  @source
end

Instance Method Details

#encode_with(coder) ⇒ Object



149
150
151
152
153
# File 'lib/bundler/rubygems_ext.rb', line 149

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

#to_lockObject



159
160
161
162
163
164
165
166
# File 'lib/bundler/rubygems_ext.rb', line 159

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_propertiesObject



155
156
157
# File 'lib/bundler/rubygems_ext.rb', line 155

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