Class: PunctuationName::Punctuation

Inherits:
Object
  • Object
show all
Defined in:
lib/punctuation_name.rb

Overview

To go here

Class Method Summary collapse

Class Method Details

.custom(name, dict) ⇒ Object



21
22
23
# File 'lib/punctuation_name.rb', line 21

def self.custom(name, dict)
    $dict[name] = dict
end

.name(punctuation, dict_name = 'uk') ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/punctuation_name.rb', line 29

def self.name(punctuation, dict_name = 'uk')
    setup

    dict_name = 'uk' if dict_name.empty?

    return punctuation unless $dict.key?(dict_name)

    name_from_dictionary(punctuation, $dict[dict_name])
end

.name_from_dictionary(punctuation, dict) ⇒ Object



25
26
27
# File 'lib/punctuation_name.rb', line 25

def self.name_from_dictionary(punctuation, dict)
    dict.key?(punctuation) ? dict[punctuation] : punctuation
end

.setupObject



16
17
18
19
# File 'lib/punctuation_name.rb', line 16

def self.setup
    $dict['uk'] = UK_NAMES
    $dict['us'] = US_NAMES
end