Sha256: 03814366d0768ce19fe48405e973a37cfe9bf3634a5e01c316d0782f8133f98c
Contents?: true
Size: 689 Bytes
Versions: 5
Compression:
Stored size: 689 Bytes
Contents
module Trailblazer class Finder class Find attr_reader :params def initialize(entity_type, params, actions) @entity_type = entity_type @actions = actions @params = params end def param(name) @params[name] end def query(context) @params.inject(@entity_type) do |entity_type, (name, value)| value = Utils::Parse.date(value) if Utils::Parse.date(value) new_entity_type = context.instance_exec entity_type, value, &@actions[name] new_entity_type || entity_type end end def count(context) query(context).count end end end end
Version data entries
5 entries across 5 versions & 1 rubygems