jgrunzweig/ptj — Issue #6: Add ability to easily call some 'analyze' functions on DataMapper collections
Author: jgrunzweig
Created: 2012-03-08 21:06:23+00:00
State: open

Example:
require 'dm-core'

module DataMapper

class Collection < LazyArray

def get_value(entry)
return_hash = {}
object = self
return_hash["Lower"] = object.count(:upper => false, :special => false, :lower => true, :number => false)
return_hash["Upper"] = object.count(:upper => true, :special => false, :lower => false, :number => false)
return_hash["Number"] = object.count(:upper => false, :special => false, :lower => false, :number => true)
return_hash["Special"] = object.count(:upper => false, :special => true, :lower => false, :number => false)
return_hash["Lower/Upper"] = object.count(:upper => true, :special => false, :lower => true, :number => false)
return_hash["Lower/Number"] = object.count(:upper => false, :special => false, :lower => true, :number => true)
return_hash["Upper/Number"] = object.count(:upper => true, :special => false, :lower => false, :number => true)
return_hash["Lower/Special"] = object.count(:upper => false, :special => true, :lower => true, :number => false)
return_hash["Upper/Special"] = object.count(:upper => true, :special => true, :lower => false, :number => false)
return_hash["Number/Special"] = object.count(:upper => false, :special => true, :lower => false, :number =>true)
return_hash["Lower/Upper/Number"] = object.count(:upper => true, :special => false, :lower => true, :number => true)
return_hash["Lower/Upper/Special"] = object.count(:upper => true, :special => true, :lower => true, :number => false)
return_hash["Lower/Number/Special"] = object.count(:upper => false, :special => true, :lower => true, :number => true)
return_hash["Upper/Number/Special"] = object.count(:upper => true, :special => true, :lower => false, :number =>true)
return_hash["Lower/Upper/Number/Special"] = object.count(:upper => true, :special => true, :lower => true, :number => true)
return_hash
end

end

end