Module: Card::Set::All::ActiveCard

Extended by:
Card::Set
Defined in:
tmpsets/set/mod001-01_core/all/active_card.rb

Instance Method Summary collapse

Methods included from Card::Set

abstract_set?, all_set?, card_accessor, card_reader, card_writer, clean_empty_module_from_hash, clean_empty_modules, define_on_format, ensure_set, extended, process_base_module_list, process_base_modules, register_set, register_set_format, shortname, stage_method, view, write_tmp_file

Methods included from Event

#define_event, #event

Instance Method Details

#format(opts = {}) ⇒ Object

fixme -this needs a better home!



34
35
36
37
38
# File 'tmpsets/set/mod001-01_core/all/active_card.rb', line 34

def format opts={}
  opts = { format: opts.to_sym } if [Symbol, String].member? opts.class

  Card::Format.new self, opts
end

#trait_var(var_name, &block) ⇒ Object

# following may be useful, but is neither tested nor in use

def card_attributes

if Card::Set.traits
  set_modules.each do |mod|
    if mod_traits = Card::Set.traits[mod]
      return mod_traits
    end
  end
end
nil

end

def trait_var? var_name

!instance_variable_get( var_name ).nil?

end



25
26
27
28
29
30
31
# File 'tmpsets/set/mod001-01_core/all/active_card.rb', line 25

def trait_var var_name, &block
  # FIXME - following optimization attempt needs to handle cache clearing!
#  instance_variable_get var_name or begin
#    instance_variable_set var_name, block_given? ? yield : raise("no block?")
#  end
  yield
end