Module: Card::Set::Abstract::Search

Extended by:
Card::Set
Defined in:
tmpsets/set/mod020-search/abstract/search.rb,
tmpsets/set/mod020-search/abstract/search/views.rb

Overview

Set: Abstract (Search)

Defined Under Namespace

Modules: Format, Views

Class Method Summary collapse

Instance Method Summary collapse

Methods included from I18nScope

#mod_name, #scope

Methods included from Loader

#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set

Methods included from Helpers

#abstract_set?, #all_set?, #num_set_parts, #shortname, #underscore

Methods included from Card::Set::AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket, #unshift_basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Class Method Details

.source_locationObject



7
# File 'tmpsets/set/mod020-search/abstract/search.rb', line 7

def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/search/set/abstract/search.rb"; end

Instance Method Details

#cached_search(args = {}) ⇒ Object



16
17
18
19
# File 'tmpsets/set/mod020-search/abstract/search.rb', line 16

def cached_search args={}
  @search_results ||= {}
  @search_results[args.to_s] ||= search args
end

#count(args = {}) ⇒ Object



41
42
43
44
45
# File 'tmpsets/set/mod020-search/abstract/search.rb', line 41

def count args={}
  args[:offset] = 0
  args[:limit] = 0
  returning(:count, args) { search args }
end

#each_item_name_with_options(_content = nil) ⇒ Object



52
53
54
55
56
57
58
59
# File 'tmpsets/set/mod020-search/abstract/search.rb', line 52

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

#item_cards(args = {}) ⇒ Object



26
27
28
29
# File 'tmpsets/set/mod020-search/abstract/search.rb', line 26

def item_cards args={}
  args[:limit] ||= 0
  returning(:card, args) { search args }
end

#item_ids(args = {}) ⇒ Object



36
37
38
39
# File 'tmpsets/set/mod020-search/abstract/search.rb', line 36

def item_ids args={}
  args[:limit] ||= 0
  returning(:id, args) { search args }
end

#item_names(args = {}) ⇒ Object



31
32
33
34
# File 'tmpsets/set/mod020-search/abstract/search.rb', line 31

def item_names args={}
  args[:limit] ||= 0
  returning(:name, args) { search args }
end

#item_typeObject

for override



48
49
50
# File 'tmpsets/set/mod020-search/abstract/search.rb', line 48

def item_type
  nil
end

#returning(item, args) ⇒ Object



21
22
23
24
# File 'tmpsets/set/mod020-search/abstract/search.rb', line 21

def returning item, args
  args[:return] = item
  yield
end

#search(_args = {}) ⇒ Object

Raises:



12
13
14
# File 'tmpsets/set/mod020-search/abstract/search.rb', line 12

def search _args={}
  raise Error, "search not overridden"
end