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

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

Overview

Set: All cards (Initialize)

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

JUNK_INIT_ARGS =
%i[missing skip_virtual id].freeze

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/mod002-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_set_modules(args) ⇒ Object



52
53
54
55
56
# File 'card/tmpsets/set/mod002-core/all/initialize.rb', line 52

def handle_set_modules args
  skip_modules = args.delete "skip_modules"
  yield
  include_set_modules unless skip_modules
end

#handle_type(args) ⇒ Object



58
59
60
61
62
63
64
# File 'card/tmpsets/set/mod002-core/all/initialize.rb', line 58

def handle_type args
  type_lookup = args["type_lookup"]
  @supercard = args.delete "supercard"

  yield
  type_id_from_template if type_lookup == :force || (!type_id && type_lookup != :skip)
end

#include_set_modulesObject



70
71
72
73
74
75
76
77
78
79
# File 'card/tmpsets/set/mod002-core/all/initialize.rb', line 70

def include_set_modules
  return self if @set_mods_loaded

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

#initial_name(name) ⇒ Object



66
67
68
# File 'card/tmpsets/set/mod002-core/all/initialize.rb', line 66

def initial_name name
  name.is_a?(String) ? name : Card::Name[name].to_s
end

#initialize(args = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'card/tmpsets/set/mod002-core/all/initialize.rb', line 41

def initialize args={}
  args["name"] = initial_name args["name"]

  handle_set_modules args do
    handle_type args do
      super args # ActiveRecord #initialize
    end
  end
  self
end

#set_mods_loaded?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'card/tmpsets/set/mod002-core/all/initialize.rb', line 81

def set_mods_loaded?
  @set_mods_loaded == true
end

#uncacheable?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'card/tmpsets/set/mod002-core/all/initialize.rb', line 81

def uncacheable?
  @uncacheable == true
end