Module: Scruffy::Helpers::PointContainer::Hash

Defined in:
lib/scruffy/helpers/point_container.rb

Instance Method Summary collapse

Instance Method Details

#inject(memo) ⇒ Object



58
59
60
61
62
63
# File 'lib/scruffy/helpers/point_container.rb', line 58

def inject memo
  (minimum_key..maximum_key).each do |i|
    memo = yield memo, self[i]
  end
  memo
end

#maximum_keyObject



54
55
56
# File 'lib/scruffy/helpers/point_container.rb', line 54

def maximum_key
  self.keys.sort.last
end

#minimum_keyObject



50
51
52
# File 'lib/scruffy/helpers/point_container.rb', line 50

def minimum_key
  self.keys.sort.first
end

#sizeObject



65
66
67
# File 'lib/scruffy/helpers/point_container.rb', line 65

def size
  maximum_key - minimum_key + 1
end