Module: Card::Set::All::Type
- Extended by:
- Card::Set
- Defined in:
- platypus/tmp/set/gem-card/mod001-core/all/type.rb
Overview
Set: All cards (Type)
Defined Under Namespace
Modules: ClassMethods
Constant Summary
Constants included from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Constants included from Event::Api
Class Method Summary collapse
Instance Method Summary collapse
-
#event: validate_type ⇒ Object
-
#event: validate_type_change ⇒ Object
-
#type=(type_name) ⇒ Object
-
#type_card ⇒ Object
-
#type_cardname ⇒ Object
-
#type_code ⇒ Object
-
#type_id=(card_or_id) ⇒ Object
-
#type_name ⇒ Object
(also: #type)
-
#type_name_or_default ⇒ Object
Methods included from Card::Set
Methods included from I18nScope
Methods included from Registrar
#extended, #finalize_load, #process_base_modules, #register_set
Methods included from Helpers
#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name
Methods included from Card::Set::AdvancedApi
#assign_type, #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 Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
Class Method Details
.source_location ⇒ Object
7 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/type.rb', line 7 def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/all/type.rb"; end |
Instance Method Details
#event: validate_type ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/type.rb', line 23 event :validate_type, :validate, changed: :type_id, on: :save do errors.add :type, t(:core_error_no_such_type) unless type_name if structure&.assigns_type? && type_id != structure.type_id errors.add :type, t(:core_error_hard_templated, name: name, type_name: structure.type_name) end end |
#event: validate_type_change ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/type.rb', line 14 event :validate_type_change, :validate, on: :update, changed: :type_id do return unless (c = dup) && (c.action == :create) && !c.valid? errors.add :type, t(:core_error_cant_change_errors, name: name, type_id: type_id, error_messages: c.errors.) end |
#type=(type_name) ⇒ Object
54 55 56 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/type.rb', line 54 def type= type_name self.type_id = type_name.card_id end |
#type_card ⇒ Object
32 33 34 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/type.rb', line 32 def type_card Card.quick_fetch type_id.to_i unless type_id.nil? end |
#type_cardname ⇒ Object
50 51 52 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/type.rb', line 50 def type_cardname type_card.try :name end |
#type_code ⇒ Object
36 37 38 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/type.rb', line 36 def type_code Card::Codename[type_id.to_i] end |
#type_id=(card_or_id) ⇒ Object
58 59 60 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/type.rb', line 58 def type_id= card_or_id write_card_or_id :type_id, card_or_id end |
#type_name ⇒ Object Also known as: type
40 41 42 |
# File 'platypus/tmp/set/gem-card/mod001-core/all/type.rb', line 40 def type_name type_card.try :name end |