Sha256: c3ec6014980e51c4d2efddf0456b9257a028bf9fdb3f7bc2a0e1a79023e3203b

Contents?: true

Size: 892 Bytes

Versions: 2

Compression:

Stored size: 892 Bytes

Contents

require_relative 'punctuation_name/version'
require_relative 'punctuation_name/overloads'
require_relative 'punctuation_name/dicts/uk.rb'
require_relative 'punctuation_name/dicts/us.rb'

#
# Add docs
#
module PunctuationName
    #
    # To go here
    #
    class Punctuation
        $dict = {}

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

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

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

        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
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
punctuation_name-1.1.2 lib/punctuation_name.rb
punctuation_name-1.1.1 lib/punctuation_name.rb