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



23
24
25
# File 'lib/punctuation_name.rb', line 23

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

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



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

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



27
28
29
# File 'lib/punctuation_name.rb', line 27

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

.setupObject



18
19
20
21
# File 'lib/punctuation_name.rb', line 18

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