Module: Daigaku::Storeable

Defined in:
lib/daigaku/storeable.rb

Constant Summary collapse

LEADING_NUMBERS =
/^\d+[\_\-\s]+/
PART_JOINTS =
/[\_\-\s]+/

Class Method Summary collapse

Class Method Details

.key(text, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/daigaku/storeable.rb', line 7

def key(text, options = {})
  separator      = QuickStore.config.key_separator
  prefix         = options[:prefix]
  suffix         = clean(options[:suffix])
  suffixes       = options[:suffixes]
  suffixes_items = suffixes ? suffixes.map { |s| clean(s) }.compact : nil

  [prefix, clean(text), suffix || suffixes_items].compact.join(separator)
end