class Hash

Public Instance Methods

retry?() click to toggle source
# File lib/rantly/shrinks.rb, line 190
def retry?
  false
end
shrink() click to toggle source
# File lib/rantly/shrinks.rb, line 169
def shrink
  if any? { |_, v| v.respond_to?(:shrinkable?) && v.shrinkable? }
    key, = detect { |_, v| v.respond_to?(:shrinkable?) && v.shrinkable? }
    clone = dup
    clone[key] = clone[key].shrink
    clone
  elsif !empty?
    key = keys.first
    h2 = dup
    h2.delete(key)
    h2
  else
    self
  end
end
shrinkable?() click to toggle source
# File lib/rantly/shrinks.rb, line 185
def shrinkable?
  any? { |_, v| v.respond_to?(:shrinkable?) && v.shrinkable? } ||
    !empty?
end