lib/allocation_stats/allocations_proxy.rb
# Select allocations that match `conditions`.
#
# @param [Hash] conditions pairs of attribute names and values to be matched amongst allocations.
#
# @example select allocations of String objects:
#   allocations.where(class: String)
Select allocations that match `conditions`.
Select allocations that match ` conditions ` .
def where(conditions)
      @wheres << Proc.new do |allocations|
        conditions = conditions.inject({}) do |memo, pair|
          faux, value = *pair
          getter = attribute_getters([faux]).first
          memo.merge(getter => value)
        end
        allocations.select do |allocation|
          conditions.all? { |getter, value| getter.call(allocation) == value }
        end
      end
      self
    end
def where ( conditions ) @wheres << Proc . new do | allocations | conditions = conditions . inject ( { } ) do | memo , pair | faux , value = * pair getter = attribute_getters ( [ faux ] ) . first memo . merge ( getter => value ) end allocations . select do | allocation | conditions . all? { | getter , value | getter . call ( allocation ) == value } end end self end
Select allocations that match `conditions`.
Select allocations that match ` conditions ` .
conditions
<not_specific>
<not_specific>
conditions pairs of attribute names and values to be matched amongst allocations.
conditions pairs of attribute names and values to be matched amongst allocations .
example
select allocations of String objects: allocations.where(class: String)
select allocations of String objects : allocations . where ( class : String )