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

Extended by:
Card::Set
Defined in:
card/tmpsets/set/mod035-card-mod-search/abstract/05_search.rb,
card/tmpsets/set/mod035-card-mod-search/abstract/05_search/views.rb,
card/tmpsets/set/mod036-card-mod-search/abstract/05_search.rb,
card/tmpsets/set/mod036-card-mod-search/abstract/05_search/views.rb

Overview

Set: Abstract (Search)

Defined Under Namespace

Modules: Format, Views

Constant Summary

Constants included from Helpers

Helpers::SET_PATTERN_TEST_REGEXP

Constants included from Event::Api

Event::Api::OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Card::Set

reset_modules

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

#method_missing, #num_set_parts, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscore

Methods included from Card::Set::AdvancedApi

#attachment, #define_set_from_error, #ensure_set, #setting_opts, #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 'card/tmpsets/set/mod035-card-mod-search/abstract/05_search.rb', line 7

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

Instance Method Details

#cached_search(args = {}) ⇒ Object



16
17
18
19
# File 'card/tmpsets/set/mod035-card-mod-search/abstract/05_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 'card/tmpsets/set/mod035-card-mod-search/abstract/05_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 'card/tmpsets/set/mod035-card-mod-search/abstract/05_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 'card/tmpsets/set/mod035-card-mod-search/abstract/05_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 'card/tmpsets/set/mod035-card-mod-search/abstract/05_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 'card/tmpsets/set/mod035-card-mod-search/abstract/05_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 'card/tmpsets/set/mod035-card-mod-search/abstract/05_search.rb', line 48

def item_type
  nil
end

#returning(item, args) ⇒ Object



21
22
23
24
# File 'card/tmpsets/set/mod035-card-mod-search/abstract/05_search.rb', line 21

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

#search(_args = {}) ⇒ Object

Raises:



12
13
14
# File 'card/tmpsets/set/mod035-card-mod-search/abstract/05_search.rb', line 12

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