Class: Card::Set::TypePlusRight

Inherits:
Pattern::Abstract show all
Defined in:
tmpsets/set_pattern/107-type_plus_right.rb,
tmpsets/set/mod017-follow/type_plus_right/user/follow.rb,
tmpsets/set/mod025-account/type_plus_right/user/email.rb,
tmpsets/set/mod017-follow/type_plus_right/user/follow/follow_editor_helper.rb,
tmpsets/set/mod026-bootstrap/type_plus_right/customized_bootswatch_skin/colors.rb

Overview

Set Pattern: TypePlusRight

Patterned field names on a specific type

Defined Under Namespace

Modules: CustomizedBootswatchSkin, User

Constant Summary collapse

@@options =
{
  junction_only: true,
  assigns_type: true,
  anchor_parts_count: 2
}

Class Method Summary collapse

Methods inherited from Pattern::Abstract

#anchor_codenames, #anchor_parts, #anchor_parts_count, anchorless?, #find_anchor_id, #format_module_list, #initialize, #inspect, junction_only?, #lookup_module_list, module_key, #module_key, #module_list, new, pattern, #pattern, pattern_applies?, register, #rule_set_key, #safe_key, #to_s

Constructor Details

This class inherits a constructor from Card::Set::Pattern::Abstract

Class Method Details

.anchor_name(card) ⇒ Object



32
33
34
35
# File 'tmpsets/set_pattern/107-type_plus_right.rb', line 32

def anchor_name card
  type_name = card.left(new: {})&.type_name || Card.default_type_id.cardname
  "#{type_name}+#{card.name.tag}"
end

.label(name) ⇒ Object



15
16
17
18
# File 'tmpsets/set_pattern/107-type_plus_right.rb', line 15

def label name
  name = name.to_name
  %(All "+#{name.tag}" cards on "#{name.left}" cards)
end

.prototype_args(anchor) ⇒ Object



25
26
27
28
29
30
# File 'tmpsets/set_pattern/107-type_plus_right.rb', line 25

def prototype_args anchor
  {
    name: "+#{anchor.tag}",
    supercard: Card.new(name: "*dummy", type: anchor.trunk_name)
  }
end

.short_label(name) ⇒ Object



20
21
22
23
# File 'tmpsets/set_pattern/107-type_plus_right.rb', line 20

def short_label name
  name = name.to_name
  %(all "+#{name.tag}" on "#{name.left}s")
end