Module: Card::Set::All::AssignAttributes

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

Overview

Set: All cards (AssignAttributes)

Defined Under Namespace

Modules: ClassMethods

Constant Summary

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/assign_attributes.rb', line 7

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

Instance Method Details

#assign_attributes(args = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'tmpsets/set/mod003-core/all/assign_attributes.rb', line 9

def assign_attributes args={}
  args = prepare_assignment_args args

  assign_with_subcards args do
    assign_with_set_modules args do
      params = prepare_assignment_params args
      super params
    end
  end
end

#assign_set_specific_attributesObject



20
21
22
23
24
# File 'tmpsets/set/mod003-core/all/assign_attributes.rb', line 20

def assign_set_specific_attributes
  set_specific.each_pair do |name, value|
    send "#{name}=", value
  end
end

#extract_subcard_args!(args) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'tmpsets/set/mod003-core/all/assign_attributes.rb', line 26

def extract_subcard_args! args
  subcards = args.delete("subcards") || args.delete(:subcards) || {}
  if (subfields = args.delete("subfields") || args.delete(:subfields))
    subfields.each_pair do |key, value|
      subcards[name.field(key)] = value
    end
  end
  args.keys.each do |key|
    subcards[key] = args.delete(key) if key =~ /^\+/
  end
  subcards = subcards.to_unsafe_h if subcards.respond_to?(:to_unsafe_h)
  subcards
end