Module: Card::Set::All::Fetch

Extended by:
Card::Set
Defined in:
card/tmpsets/set/mod002-core/all/fetch.rb

Overview

= Card#fetch

Defined Under Namespace

Modules: ClassMethods

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



9
# File 'card/tmpsets/set/mod002-core/all/fetch.rb', line 9

def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/all/fetch.rb"; end

Instance Method Details

#fetch(traits, opts = {}) ⇒ Object


INSTANCE METHODS fetching from the context of a card



106
107
108
109
110
111
# File 'card/tmpsets/set/mod002-core/all/fetch.rb', line 106

def fetch traits, opts={}
  opts[:new][:supercard] = self if opts[:new]
  Array.wrap(traits).inject(self) do |card, trait|
    Card.fetch card.name.trait(trait), opts
  end
end

#newish(opts) ⇒ Object



113
114
115
116
117
118
119
120
121
# File 'card/tmpsets/set/mod002-core/all/fetch.rb', line 113

def newish opts
  reset_patterns
  Card.with_normalized_new_args opts do |norm_opts|
    handle_type norm_opts do
      assign_attributes norm_opts
      self.name = name # trigger superize_name
    end
  end
end

#refresh(force = false) ⇒ Object



123
124
125
126
127
128
129
# File 'card/tmpsets/set/mod002-core/all/fetch.rb', line 123

def refresh force=false
  return self unless force || frozen? || readonly?
  return unless id
  fresh_card = self.class.find id
  fresh_card.include_set_modules
  fresh_card
end