Class: Bundler::Checksum::Source

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, location) ⇒ Source

Returns a new instance of Source.



123
124
125
126
# File 'lib/bundler/checksum.rb', line 123

def initialize(type, location)
  @type = type
  @location = location
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



121
122
123
# File 'lib/bundler/checksum.rb', line 121

def location
  @location
end

#typeObject (readonly)

Returns the value of attribute type.



121
122
123
# File 'lib/bundler/checksum.rb', line 121

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



132
133
134
# File 'lib/bundler/checksum.rb', line 132

def ==(other)
  other.is_a?(self.class) && other.type == type && other.location == location
end

#removable?Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/bundler/checksum.rb', line 128

def removable?
  type == :lock || type == :gem
end

#removalObject

A full sentence describing how to remove the checksum



152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/bundler/checksum.rb', line 152

def removal
  case type
  when :lock
    "remove the matching checksum in #{location}"
  when :gem
    "remove the gem at #{location}"
  when :api
    "checksums from #{location} cannot be locally modified, you may need to update your sources"
  else
    "remove #{location} (#{type})"
  end
end

#to_sObject

phrased so that the usual string format is grammatically correct

rake (10.3.2) sha256=abc123 from #{to_s}


138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/bundler/checksum.rb', line 138

def to_s
  case type
  when :lock
    "the lockfile CHECKSUMS at #{location}"
  when :gem
    "the gem at #{location}"
  when :api
    "the API at #{location}"
  else
    "#{location} (#{type})"
  end
end