Class: Card::Name
- Inherits:
-
Cardname
- Object
- Cardname
- Card::Name
show all
- Includes:
- FieldsAndTraits, NameVariants
- Defined in:
- lib/card/name.rb,
lib/card/name/name_variants.rb,
lib/card/name/fields_and_traits.rb
Overview
The Cardname class provides generalized of Card naming patterns
(compound names, key-based variants, etc)
Card::Name adds support for deeper card integration
Defined Under Namespace
Modules: FieldsAndTraits, NameVariants
Class Method Summary
collapse
Instance Method Summary
collapse
#vary
#field, #field_name, #field_of?, #field_only?, #relative_field_name, #trait, #trait_name, #trait_name?
Class Method Details
.[](*cardish) ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/card/name.rb', line 19
def [] *cardish
cardish = cardish.first if cardish.size <= 1
case cardish
when Card then cardish.name
when Symbol, Integer then Card.fetch_name(cardish)
when Array then compose cardish
else cardish.to_name
end
end
|
.compose(parts) ⇒ Object
29
30
31
|
# File 'lib/card/name.rb', line 29
def compose parts
new parts.flatten.map { |part| self[part] }.join(joint)
end
|
.url_key_to_standard(key) ⇒ Object
33
34
35
|
# File 'lib/card/name.rb', line 33
def url_key_to_standard key
key.to_s.tr "_", " "
end
|
Instance Method Details
#code ⇒ Object
46
47
48
|
# File 'lib/card/name.rb', line 46
def code
Card::Codename[Card.fetch_id self]
end
|
#rstar? ⇒ Boolean
42
43
44
|
# File 'lib/card/name.rb', line 42
def rstar?
right && "*" == right[0, 1]
end
|
#star? ⇒ Boolean
38
39
40
|
# File 'lib/card/name.rb', line 38
def star?
simple? && "*" == s[0, 1]
end
|