123456789_123456789_123456789_123456789_123456789_

Class: Bundler::Checksum::Source

Relationships & Source Files
Inherits: Object
Defined in: lib/bundler/checksum.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

  • #==(other)
  • #removal

    A full sentence describing how to remove the checksum.

  • #to_s

    phrased so that the usual string format is grammatically correct.

Constructor Details

.new(type, location) ⇒ Source

[ GitHub ]

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

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

Instance Attribute Details

#location (readonly)

[ GitHub ]

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

attr_reader :type, :location

#removable?Boolean (readonly)

[ GitHub ]

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

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

#type (readonly)

[ GitHub ]

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

attr_reader :type, :location

Instance Method Details

#==(other)

[ GitHub ]

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

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

#removal

A full sentence describing how to remove the checksum

[ GitHub ]

  
# 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_s

phrased so that the usual string format is grammatically correct

rake (10.3) sha256=abc123 from #{to_s}
[ GitHub ]

  
# 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