Sha256: 6de59d69abdccf8e92f0e97489176c314eb7900f8ae4e0b85a745b3160b63f5e

Contents?: true

Size: 971 Bytes

Versions: 5

Compression:

Stored size: 971 Bytes

Contents

module Nineteen
  module Eighty
    module Two
      class Messages
        MESSAGES = YAML.load_file File.join File.dirname(__FILE__), '..', '..', '..', '..', 'config', 'messages.yml'

        def self.[] key
          key = key.to_s.upcase
          raise Exceptions::SpectrumException.new "Q - #{MESSAGES['Q']}" unless MESSAGES.has_key? key
          "#{key} - #{MESSAGES[key]}"
        end

        def self.to_h
          MESSAGES
        end

        def self.method_missing m, *args
          key = case m
          when :zero
            0
          when :one
            1
          when :two
            2
          when :three
            3
          when :four
            4
          when :five
            5
          when :six
            6
          when :seven
            7
          when :eight
            8
          when :nine
            9
          else
            m.to_s
          end
          self[key]
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nineteen-eighty-two-0.1.9 lib/nineteen/eighty/two/messages.rb
nineteen-eighty-two-0.1.8 lib/nineteen/eighty/two/messages.rb
nineteen-eighty-two-0.1.7 lib/nineteen/eighty/two/messages.rb
nineteen-eighty-two-0.1.6 lib/nineteen/eighty/two/messages.rb
nineteen-eighty-two-0.1.5 lib/nineteen/eighty/two/messages.rb