Class: Card::Name

Inherits:
SmartName
  • Object
show all
Includes:
FieldsAndTraits, NameVariants
Defined in:
lib/card/name.rb,
lib/card/name/view_name.rb,
lib/card/name/name_variants.rb,
lib/card/name/fields_and_traits.rb

Overview

The SmartName 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 Classes: ViewName

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NameVariants

#vary

Methods included from FieldsAndTraits

#field, #field_name, #field_of?, #relative_field_name, #trait, #trait_name, #trait_name?

Class Method Details

.cardish(mark) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/card/name.rb', line 20

def cardish mark
  case mark
  when Card            then mark.cardname
  when Symbol, Integer then Card.quick_fetch(mark).cardname
  else                      mark.to_name
  end
end

.url_key_to_standard(key) ⇒ Object



28
29
30
# File 'lib/card/name.rb', line 28

def url_key_to_standard key
  key.to_s.tr "_", " "
end

Instance Method Details

#codeObject



41
42
43
# File 'lib/card/name.rb', line 41

def code
  Card::Codename[Card.fetch_id self]
end

#rstar?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/card/name.rb', line 37

def rstar?
  right && "*" == right[0, 1]
end

#set?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/card/name.rb', line 49

def set?
  Set::Pattern.card_keys[tag_name.key]
end

#setting?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/card/name.rb', line 45

def setting?
  Set::Type::Setting.member_names[key]
end

#star?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/card/name.rb', line 33

def star?
  simple? && "*" == s[0, 1]
end

#title(title_directive, context_names) ⇒ Object

processes contextual title argument used in nests like "title: _left"



54
55
56
# File 'lib/card/name.rb', line 54

def title title_directive, context_names
  title_directive.to_name.to_absolute_name(self).to_show(*context_names)
end