Module: Card::Set::Type::Alias

Extended by:
Card::Set
Defined in:
card/tmpsets/set/mod018-card-mod-alias/type/alias.rb

Overview

Set: All “Alias” cards

Defined Under Namespace

Modules: HtmlFormat

Constant Summary

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 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 Card::Set::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/mod018-card-mod-alias/type/alias.rb', line 7

def self.source_location; "/Users/ethan/dev/decko/gem/card-mod-alias/set/type/alias.rb"; end

Instance Method Details

#alias?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'card/tmpsets/set/mod018-card-mod-alias/type/alias.rb', line 22

def alias?
  true
end

#event: validate_alias_sourceObject



11
12
13
14
# File 'card/tmpsets/set/mod018-card-mod-alias/type/alias.rb', line 11

event :validate_alias_source, :validate, on: :save do
  errors.add :name, t(:alias_must_be_simple) if name.compound?
  errors.add :type, t(:alias_cards_no_children) if child_ids.present?
end

#event: validate_alias_targetObject



16
17
18
19
20
# File 'card/tmpsets/set/mod018-card-mod-alias/type/alias.rb', line 16

event :validate_alias_target, :validate, on: :save do
  return if count == 1 && target_name&.simple?

  errors.add :content, t(:alias_target_must_be_simple)
end

#target_cardCard

Returns card to which card is aliased.

Returns:

  • (Card)

    card to which card is aliased



32
33
34
# File 'card/tmpsets/set/mod018-card-mod-alias/type/alias.rb', line 32

def target_card
  first_card
end

#target_nameCard::Name

Returns name to which card’s name is aliased.

Returns:

  • (Card::Name)

    name to which card’s name is aliased



27
28
29
# File 'card/tmpsets/set/mod018-card-mod-alias/type/alias.rb', line 27

def target_name
  first_name
end