Module: Card::Set::All::Subcards

Extended by:
Card::Set
Defined in:
tmpsets/set/mod001-core/all/subcards.rb

Instance Method Summary collapse

Methods included from I18nScope

#mod_name, #scope

Methods included from Loader

#clean_empty_module_from_hash, #clean_empty_modules, #extended, #pattern_and_modules_from_path, #process_base_modules, #register_set, #tmp_file_frame, #tmp_file_template, #tmp_file_wrapped_content, #write_tmp_file

Methods included from Helpers

#abstract_set?, #all_set?, #shortname

Methods included from Card::Set::AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#all_set_format_mod!, #define_on_format, #format, #register_set_format, #view

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer

Methods included from Event

#event

Instance Method Details

#attach_subcard(name_or_card, args = {}) ⇒ Object Also known as: add_subcard

phase_method :add_subcard, before: :store do |name_or_card, args=nil| TODO: handle differently in different stages



18
19
20
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 18

def attach_subcard name_or_card, args={}
  subcards.add name_or_card, args
end

#attach_subcard!(name_or_card, args = {}) ⇒ Object



23
24
25
26
27
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 23

def attach_subcard! name_or_card, args={}
  subcard = subcards.add name_or_card, args
  subcard.director.reset_stage
  subcard
end

#attach_subfield(name_or_card, args = {}) ⇒ Object Also known as: add_subfield

phase_method :add_subfield, before: :approve do |name_or_card, args=nil|



30
31
32
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 30

def attach_subfield name_or_card, args={}
  subcards.add_field name_or_card, args
end

#attach_subfield!(name_or_card, args = {}) ⇒ Object



35
36
37
38
39
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 35

def attach_subfield! name_or_card, args={}
  subcard = subcards.add_field name_or_card, args
  subcard.director.reset_stage
  subcard
end

#clear_subcardsObject



51
52
53
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 51

def clear_subcards
  subcards.clear
end

#deep_clear_subcardsObject



55
56
57
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 55

def deep_clear_subcards
  subcards.deep_clear
end

#detach_subcard(name_or_card) ⇒ Object Also known as: remove_subcard



41
42
43
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 41

def detach_subcard name_or_card
  subcards.remove name_or_card
end

#detach_subfield(name_or_card) ⇒ Object Also known as: remove_subfield



46
47
48
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 46

def detach_subfield name_or_card
  subcards.remove_field name_or_card
end

#field(tag, opts = {}) ⇒ Object

~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/core/set/all/subcards.rb ~~



4
5
6
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 4

def field tag, opts={}
  Card.fetch cardname.field(tag), opts
end

#subcard(card_name) ⇒ Object



8
9
10
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 8

def subcard card_name
  subcards.card card_name
end

#subfield(field_name) ⇒ Object



12
13
14
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 12

def subfield field_name
  subcards.field field_name
end

#unfilled?Boolean

Returns:

  • (Boolean)


59
60
61
62
63
# File 'tmpsets/set/mod001-core/all/subcards.rb', line 59

def unfilled?
  (content.empty? || content.strip.empty?) &&
    (comment.blank? || comment.strip.blank?) &&
    !subcards.present?
end