Class: Card::Set::Type
- Inherits:
-
Pattern::Abstract
show all
- Defined in:
- lib/card/set_pattern.rb,
tmpsets/set_pattern/102-type.rb,
tmpsets/set/mod010-machines/type/css.rb,
tmpsets/set/mod016-standard/type/set.rb,
tmpsets/set/mod016-standard/type/uri.rb,
tmpsets/set/mod017-account/type/user.rb,
tmpsets/set/mod010-machines/type/scss.rb,
tmpsets/set/mod010-machines/type/skin.rb,
tmpsets/set/mod016-standard/type/date.rb,
tmpsets/set/mod016-standard/type/list.rb,
tmpsets/set/mod016-standard/type/basic.rb,
tmpsets/set/mod017-account/type/signup.rb,
tmpsets/set/mod004-pointer/type/pointer.rb,
tmpsets/set/mod016-standard/type/number.rb,
tmpsets/set/mod016-standard/type/phrase.rb,
tmpsets/set/mod016-standard/type/toggle.rb,
tmpsets/set/mod009-basic_types/type/html.rb,
tmpsets/set/mod011-settings/type/setting.rb,
tmpsets/set/mod016-standard/type/session.rb,
tmpsets/set/mod016-standard/type/cardtype.rb,
tmpsets/set/mod016-standard/type/listed_by.rb,
tmpsets/set/mod010-machines/type/java_script.rb,
tmpsets/set/mod012-email/type/email_template.rb,
tmpsets/set/mod016-standard/type/layout_type.rb,
tmpsets/set/mod016-standard/type/search_type.rb,
tmpsets/set/mod009-basic_types/type/plain_text.rb,
tmpsets/set/mod010-machines/type/coffee_script.rb
Defined Under Namespace
Modules: Basic, Cardtype, CoffeeScript, Css, Date, EmailTemplate, Html, JavaScript, LayoutType, List, ListedBy, Number, Phrase, PlainText, Pointer, Scss, SearchType, Session, Set, Setting, Signup, Skin, Toggle, Uri, User
Class Method Summary
collapse
Instance Method Summary
collapse
#anchor_codenames, anchorless?, #format_module_list, #inspect, junction_only?, #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.
165
166
167
168
169
|
# File 'lib/card/set_pattern.rb', line 165
def initialize card
super
@inherit_card = card unless module_key
end
|
Class Method Details
.anchor_id(card) ⇒ Object
23
24
25
|
# File 'tmpsets/set_pattern/102-type.rb', line 23
def anchor_id card
card.type_id
end
|
.anchor_name(card) ⇒ Object
19
20
21
|
# File 'tmpsets/set_pattern/102-type.rb', line 19
def anchor_name card
card.type_name
end
|
.follow_label(name) ⇒ Object
27
28
29
|
# File 'tmpsets/set_pattern/102-type.rb', line 27
def follow_label name
%(all "#{name}s")
end
|
.label(name) ⇒ Object
~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/core/set_pattern/03_type.rb ~~
7
8
9
|
# File 'tmpsets/set_pattern/102-type.rb', line 7
def label name
%(All "#{name}" cards)
end
|
.pattern_applies?(card) ⇒ Boolean
15
16
17
|
# File 'tmpsets/set_pattern/102-type.rb', line 15
def pattern_applies? card
!!card.type_id
end
|
.prototype_args(anchor) ⇒ Object
11
12
13
|
# File 'tmpsets/set_pattern/102-type.rb', line 11
def prototype_args anchor
{ type: anchor }
end
|
Instance Method Details
#inherited_key ⇒ Object
179
180
181
182
183
184
185
|
# File 'lib/card/set_pattern.rb', line 179
def inherited_key
if defined?(@inherited_key)
@inherited_key
else
@inherited_key = lookup_inherited_key
end
end
|
#lookup_inherited_key ⇒ Object
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
# File 'lib/card/set_pattern.rb', line 187
def lookup_inherited_key
return unless @inherit_card
card = @inherit_card
@inherit_card = nil
(default_rule = card.rule_card(:default)) &&
(type_code = default_rule.type_code) &&
(mod_key = "Type::#{type_code.to_s.camelize}") &&
(Card::Set.modules[:nonbase_format].values +
[Card::Set.modules[:nonbase]]).any? { |hash| hash[mod_key] } &&
mod_key
end
|
#lookup_module_list(modules_hash) ⇒ Object
171
172
173
174
175
176
177
|
# File 'lib/card/set_pattern.rb', line 171
def lookup_module_list modules_hash
if module_key
modules_hash[module_key]
else
inherited_key && modules_hash[inherited_key]
end
end
|