Sha256: 9ef209a415d969f6dbc850140a47cb907cf74f4a1edb466f610ef424a065b1c5
Contents?: true
Size: 1.97 KB
Versions: 2
Compression:
Stored size: 1.97 KB
Contents
# -*- encoding : utf-8 -*- class Card; module Set; class Abstract # Set: Abstract (Search) # module Search; extend Card::Set def self.source_location; "/Users/ethan/dev/decko/gem/card-mod-search/set/abstract/05_search.rb"; end include_set Abstract::Paging include_set Abstract::SearchParams include_set Abstract::Filter def search _args={} raise Error, "search not overridden" end def cached_search args={} @search_results ||= {} @search_results[args.to_s] ||= search args end def returning item, args args[:return] = item yield end def item_cards args={} args[:limit] ||= 0 returning(:card, args) { search args } end def item_names args={} args[:limit] ||= 0 returning(:name, args) { search args } end def item_ids args={} args[:limit] ||= 0 returning(:id, args) { search args } end def count args={} args[:offset] = 0 args[:limit] = 0 returning(:count, args) { search args } end # for override def item_type nil end def each_item_name_with_options _content=nil options = {} item = fetch_query.statement[:view] options[:view] = item if item item_names.each do |name| yield name, options end end module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat def search_with_params @search_with_params ||= search_with_rescue search_params end def count_with_params @count_with_params ||= search_with_rescue search_params.merge(return: :count) end view :filtered_count, cache: :never do count_with_params end def search_with_rescue query_args rescuing_bad_query query_args do card.cached_search query_args end end def rescuing_bad_query query_args yield rescue Error::BadQuery => e Rails.logger.info "BadQuery: #{query_args}" e end def implicit_item_view view = voo_items_view || default_item_view Card::View.normalize view end end end;end;end;end; # ~~ generated from /Users/ethan/dev/decko/gem/card-mod-search/set/abstract/05_search.rb ~~
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
card-1.101.7 | tmpsets/set/mod036-card-mod-search/abstract/05_search.rb |
card-1.101.6 | tmpsets/set/mod036-card-mod-search/abstract/05_search.rb |