Class: Card::Set::Type

Inherits:
Pattern::Base show all
Extended by:
Pattern::Helper
Defined in:
card/tmpsets/set_pattern/102-type.rb,
card/lib/card/set/type.rb,
card/tmpsets/set/mod004-standard/type/cardtype.rb,
card/tmpsets/set/mod009-card-mod-list/type/list.rb,
card/tmpsets/set/mod012-card-mod-edit/type/list.rb,
card/tmpsets/set/mod019-card-mod-style/type/css.rb,
card/tmpsets/set/mod023-card-mod-date/type/date.rb,
card/tmpsets/set/mod036-card-mod-rules/type/set.rb,
card/tmpsets/set/mod008-card-mod-format/type/uri.rb,
card/tmpsets/set/mod019-card-mod-style/type/scss.rb,
card/tmpsets/set/mod019-card-mod-style/type/skin.rb,
card/tmpsets/set/mod025-card-mod-follow/type/set.rb,
card/tmpsets/set/mod008-card-mod-format/type/html.rb,
card/tmpsets/set/mod008-card-mod-format/type/json.rb,
card/tmpsets/set/mod025-card-mod-follow/type/user.rb,
card/tmpsets/set/mod030-card-mod-layout/type/html.rb,
card/tmpsets/set/mod009-card-mod-list/type/pointer.rb,
card/tmpsets/set/mod011-card-mod-account/type/role.rb,
card/tmpsets/set/mod011-card-mod-account/type/user.rb,
card/tmpsets/set/mod012-card-mod-edit/type/pointer.rb,
card/tmpsets/set/mod031-card-mod-legacy/type/basic.rb,
card/tmpsets/set/mod008-card-mod-format/type/number.rb,
card/tmpsets/set/mod008-card-mod-format/type/phrase.rb,
card/tmpsets/set/mod008-card-mod-format/type/toggle.rb,
card/tmpsets/set/mod036-card-mod-rules/type/setting.rb,
card/tmpsets/set/mod009-card-mod-list/type/link_list.rb,
card/tmpsets/set/mod009-card-mod-list/type/nest_list.rb,
card/tmpsets/set/mod011-card-mod-account/type/signup.rb,
card/tmpsets/set/mod012-card-mod-edit/type/plain_text.rb,
card/tmpsets/set/mod025-card-mod-follow/type/cardtype.rb,
card/tmpsets/set/mod029-card-mod-session/type/session.rb,
card/tmpsets/set/mod035-card-mod-search/type/cardtype.rb,
card/tmpsets/set/mod014-card-mod-carrierwave/type/file.rb,
card/tmpsets/set/mod008-card-mod-format/type/plain_text.rb,
card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb,
card/tmpsets/set/mod020-card-mod-bar_and_box/type/image.rb,
card/tmpsets/set/mod032-card-mod-markdown/type/markdown.rb,
card/tmpsets/set/mod017-card-mod-script/type/java_script.rb,
card/tmpsets/set/mod030-card-mod-layout/type/layout_type.rb,
card/tmpsets/set/mod035-card-mod-search/type/search_type.rb,
card/tmpsets/set/mod005-card-mod-email/type/email_template.rb,
card/tmpsets/set/mod011-card-mod-account/type/signup/views.rb,
card/tmpsets/set/mod017-card-mod-script/type/coffee_script.rb,
card/tmpsets/set/mod036-card-mod-rules/type/set/html_views.rb,
card/tmpsets/set/mod036-card-mod-rules/type/set/rules_filter.rb,
card/tmpsets/set/mod036-card-mod-rules/type/set/setting_lists.rb,
card/tmpsets/set/mod021-card-mod-bootstrap/type/bootswatch_skin.rb,
card/tmpsets/set/mod014-card-mod-carrierwave/type/image/html_views.rb,
card/tmpsets/set/mod025-card-mod-follow/type/notification_template.rb,
card/tmpsets/set/mod036-card-mod-rules/type/set/html_views/template.rb,
card/tmpsets/set/mod036-card-mod-rules/type/set/html_views/rule_lists.rb,
card/tmpsets/set/mod005-card-mod-email/type/email_template/email_config.rb,
card/tmpsets/set/mod021-card-mod-bootstrap/type/customized_bootswatch_skin.rb,
card/tmpsets/set/mod021-card-mod-bootstrap/type/customized_bootswatch_skin/html_views.rb,
card/tmpsets/set/mod002-core/type/cardtype.rb,
card/tmpsets/set/mod008-card-mod-list/type/list.rb,
card/tmpsets/set/mod011-card-mod-edit/type/list.rb,
card/tmpsets/set/mod020-card-mod-style/type/css.rb,
card/tmpsets/set/mod024-card-mod-date/type/date.rb,
card/tmpsets/set/mod037-card-mod-rules/type/set.rb,
card/tmpsets/set/mod007-card-mod-format/type/uri.rb,
card/tmpsets/set/mod020-card-mod-style/type/scss.rb,
card/tmpsets/set/mod020-card-mod-style/type/skin.rb,
card/tmpsets/set/mod026-card-mod-follow/type/set.rb,
card/tmpsets/set/mod007-card-mod-format/type/html.rb,
card/tmpsets/set/mod007-card-mod-format/type/json.rb,
card/tmpsets/set/mod018-card-mod-alias/type/alias.rb,
card/tmpsets/set/mod026-card-mod-follow/type/user.rb,
card/tmpsets/set/mod031-card-mod-layout/type/html.rb,
card/tmpsets/set/mod008-card-mod-list/type/pointer.rb,
card/tmpsets/set/mod010-card-mod-account/type/role.rb,
card/tmpsets/set/mod010-card-mod-account/type/user.rb,
card/tmpsets/set/mod011-card-mod-edit/type/pointer.rb,
card/tmpsets/set/mod032-card-mod-legacy/type/basic.rb,
card/tmpsets/set/mod007-card-mod-format/type/number.rb,
card/tmpsets/set/mod007-card-mod-format/type/phrase.rb,
card/tmpsets/set/mod007-card-mod-format/type/toggle.rb,
card/tmpsets/set/mod037-card-mod-rules/type/setting.rb,
card/tmpsets/set/mod008-card-mod-list/type/link_list.rb,
card/tmpsets/set/mod008-card-mod-list/type/nest_list.rb,
card/tmpsets/set/mod010-card-mod-account/type/signup.rb,
card/tmpsets/set/mod037-card-mod-rules/type/cardtype.rb,
card/tmpsets/set/mod007-card-mod-format/type/cardtype.rb,
card/tmpsets/set/mod011-card-mod-edit/type/plain_text.rb,
card/tmpsets/set/mod026-card-mod-follow/type/cardtype.rb,
card/tmpsets/set/mod030-card-mod-session/type/session.rb,
card/tmpsets/set/mod036-card-mod-search/type/cardtype.rb,
card/tmpsets/set/mod013-card-mod-carrierwave/type/file.rb,
card/tmpsets/set/mod007-card-mod-format/type/plain_text.rb,
card/tmpsets/set/mod013-card-mod-carrierwave/type/image.rb,
card/tmpsets/set/mod021-card-mod-bar_and_box/type/image.rb,
card/tmpsets/set/mod033-card-mod-markdown/type/markdown.rb,
card/tmpsets/set/mod016-card-mod-script/type/java_script.rb,
card/tmpsets/set/mod031-card-mod-layout/type/layout_type.rb,
card/tmpsets/set/mod036-card-mod-search/type/search_type.rb,
card/tmpsets/set/mod004-card-mod-email/type/email_template.rb,
card/tmpsets/set/mod010-card-mod-account/type/signup/views.rb,
card/tmpsets/set/mod016-card-mod-script/type/coffee_script.rb,
card/tmpsets/set/mod037-card-mod-rules/type/set/html_views.rb,
card/tmpsets/set/mod037-card-mod-rules/type/set/rules_filter.rb,
card/tmpsets/set/mod037-card-mod-rules/type/set/setting_lists.rb,
card/tmpsets/set/mod022-card-mod-bootstrap/type/bootswatch_skin.rb,
card/tmpsets/set/mod013-card-mod-carrierwave/type/image/html_views.rb,
card/tmpsets/set/mod026-card-mod-follow/type/notification_template.rb,
card/tmpsets/set/mod037-card-mod-rules/type/set/html_views/template.rb,
card/tmpsets/set/mod037-card-mod-rules/type/set/html_views/rule_lists.rb,
card/tmpsets/set/mod004-card-mod-email/type/email_template/email_config.rb,
card/tmpsets/set/mod022-card-mod-bootstrap/type/customized_bootswatch_skin.rb,
card/tmpsets/set/mod022-card-mod-bootstrap/type/customized_bootswatch_skin/html_views.rb

Overview

Set Pattern: Type

Defined Under Namespace

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

Instance Attribute Summary

Attributes included from Pattern::ClassMethods

#anchor_parts_count, #anchorless, #assigns_type, #junction_only, #pattern_code, #pattern_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pattern::Base

#anchor_codenames, #anchor_parts, #anchor_parts_count, #find_anchor_id, #format_module_list, #inspect, #module_key, #module_list, #pattern, #rule_set_key, #safe_key, #to_s

Methods included from Pattern::ClassMethods

#anchorless?, #generic_label, #junction_only?, #module_key, #new, #pattern, #pattern_applies?, #register

Constructor Details

#initialize(card) ⇒ Type

Returns a new instance of Type.



4
5
6
7
8
# File 'card/lib/card/set/type.rb', line 4

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

Class Method Details

.anchor_id(card) ⇒ Object



34
35
36
# File 'card/tmpsets/set_pattern/102-type.rb', line 34

def anchor_id card
  card.type_id
end

.anchor_name(card) ⇒ Object



30
31
32
# File 'card/tmpsets/set_pattern/102-type.rb', line 30

def anchor_name card
  card.type_name
end

.generic_labelObject



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

def generic_label
  "cards of a given type"
end

.label(name) ⇒ Object



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

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

.pattern_applies?(card) ⇒ Boolean

Returns:

  • (Boolean)


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

def pattern_applies? card
  !!card.type_id
end

.prototype_args(anchor) ⇒ Object



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

def prototype_args anchor
  { type: anchor }
end

.short_label(name) ⇒ Object



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

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

Instance Method Details

#lookup_module_list(modules_hash) ⇒ Object



10
11
12
13
# File 'card/lib/card/set/type.rb', line 10

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