Module: Card::Set::All::Initialize

Extended by:
Card::Set
Defined in:
tmpsets/set/mod003-core/all/initialize.rb

Overview

Set: All cards (Initialize)

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

JUNK_INIT_ARGS =
%w[missing skip_virtual id].freeze

Constants included from Helpers

Helpers::SET_PATTERN_TEST_REGEXP

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, #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/mod003-core/all/initialize.rb', line 7

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

Instance Method Details

#handle_skip_args(args) ⇒ Object



31
32
33
34
35
36
37
# File 'tmpsets/set/mod003-core/all/initialize.rb', line 31

def handle_skip_args args
  skip_modules = args.delete "skip_modules"
  skip_type_lookup = args["skip_type_lookup"]
  yield
  self.type_id = get_type_id_from_structure if !type_id && !skip_type_lookup
  include_set_modules unless skip_modules
end

#include_set_modulesObject



44
45
46
47
48
49
50
51
52
53
# File 'tmpsets/set/mod003-core/all/initialize.rb', line 44

def include_set_modules
  unless @set_mods_loaded
    set_modules.each do |m|
      singleton_class.send :include, m
    end
    assign_set_specific_attributes
    @set_mods_loaded = true
  end
  self
end

#initial_name(name) ⇒ Object



39
40
41
42
# File 'tmpsets/set/mod003-core/all/initialize.rb', line 39

def initial_name name
  return name if name.is_a? String
  Card::Name[name].to_s
end

#initialize(args = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'tmpsets/set/mod003-core/all/initialize.rb', line 20

def initialize args={}
  args["name"] = initial_name args["name"]
  args["db_content"] = args.delete "content" if args["content"]
  @supercard = args.delete "supercard" # must come before name=

  handle_skip_args args do
    super args # ActiveRecord #initialize
  end
  self
end