Class: Card::Set::Type

Inherits:
Pattern::Abstract show all
Defined in:
tmpsets/set_pattern/102-type.rb,
lib/card/set_pattern.rb,
tmpsets/set/mod022-rules/type/set.rb,
tmpsets/set/mod024-date/type/date.rb,
tmpsets/set/mod017-follow/type/set.rb,
tmpsets/set/mod017-follow/type/user.rb,
tmpsets/set/mod014-machines/type/css.rb,
tmpsets/set/mod021-standard/type/uri.rb,
tmpsets/set/mod025-account/type/user.rb,
tmpsets/set/mod014-machines/type/scss.rb,
tmpsets/set/mod014-machines/type/skin.rb,
tmpsets/set/mod021-standard/type/list.rb,
tmpsets/set/mod021-standard/type/basic.rb,
tmpsets/set/mod025-account/type/signup.rb,
tmpsets/set/mod008-pointer/type/pointer.rb,
tmpsets/set/mod017-follow/type/cardtype.rb,
tmpsets/set/mod021-standard/type/number.rb,
tmpsets/set/mod021-standard/type/phrase.rb,
tmpsets/set/mod021-standard/type/toggle.rb,
tmpsets/set/mod013-basic_types/type/html.rb,
tmpsets/set/mod013-basic_types/type/json.rb,
tmpsets/set/mod015-settings/type/setting.rb,
tmpsets/set/mod019-carrierwave/type/file.rb,
tmpsets/set/mod021-standard/type/session.rb,
tmpsets/set/mod019-carrierwave/type/image.rb,
tmpsets/set/mod021-standard/type/cardtype.rb,
tmpsets/set/mod020-search/type/search_type.rb,
tmpsets/set/mod021-standard/type/listed_by.rb,
tmpsets/set/mod014-machines/type/java_script.rb,
tmpsets/set/mod016-email/type/email_template.rb,
tmpsets/set/mod021-standard/type/layout_type.rb,
tmpsets/set/mod022-rules/type/set/html_views.rb,
tmpsets/set/mod013-basic_types/type/plain_text.rb,
tmpsets/set/mod014-machines/type/coffee_script.rb,
tmpsets/set/mod022-rules/type/set/rules_filter.rb,
tmpsets/set/mod022-rules/type/set/setting_lists.rb,
tmpsets/set/mod026-bootstrap/type/bootswatch_skin.rb,
tmpsets/set/mod022-rules/type/set/html_views/template.rb,
tmpsets/set/mod021-standard/type/notification_template.rb,
tmpsets/set/mod022-rules/type/set/html_views/nest_rules.rb,
tmpsets/set/mod016-email/type/email_template/email_config.rb,
tmpsets/set/mod022-rules/type/set/html_views/rules_bridge.rb,
tmpsets/set/mod026-bootstrap/type/customized_bootswatch_skin.rb,
tmpsets/set/mod026-bootstrap/type/customized_bootswatch_skin/html_views.rb

Overview

Set Pattern: Type

Defined Under Namespace

Modules: Basic, BootswatchSkin, Cardtype, CoffeeScript, Css, CustomizedBootswatchSkin, Date, EmailTemplate, File, Html, Image, JavaScript, Json, LayoutType, List, ListedBy, NotificationTemplate, Number, Phrase, PlainText, Pointer, Scss, SearchType, Session, Set, Setting, Signup, Skin, Toggle, Uri, User

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pattern::Abstract

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

Constructor Details

#initialize(card) ⇒ Type

Returns a new instance of Type.



166
167
168
169
170
# File 'lib/card/set_pattern.rb', line 166

def initialize card
  super
  # support type inheritance
  @inherit_card = card unless module_key
end

Class Method Details

.anchor_id(card) ⇒ Object



27
28
29
# File 'tmpsets/set_pattern/102-type.rb', line 27

def anchor_id card
  card.type_id
end

.anchor_name(card) ⇒ Object



23
24
25
# File 'tmpsets/set_pattern/102-type.rb', line 23

def anchor_name card
  card.type_name
end

.label(name) ⇒ Object



7
8
9
# File 'tmpsets/set_pattern/102-type.rb', line 7

def label name
  %(All "#{name}" cards)
end

.pattern_applies?(card) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'tmpsets/set_pattern/102-type.rb', line 19

def pattern_applies? card
  !!card.type_id
end

.prototype_args(anchor) ⇒ Object



15
16
17
# File 'tmpsets/set_pattern/102-type.rb', line 15

def prototype_args anchor
  { type: anchor }
end

.short_label(name) ⇒ Object



11
12
13
# File 'tmpsets/set_pattern/102-type.rb', line 11

def short_label name
  %(all "#{name}s")
end

Instance Method Details

#lookup_module_list(modules_hash) ⇒ Object



172
173
174
175
# File 'lib/card/set_pattern.rb', line 172

def lookup_module_list modules_hash
  lookup_key = module_key || inherited_key
  modules_hash[lookup_key] if lookup_key
end