Sha256: 6102b57e724ae3ee7ebb3e89228dc5494528231ce94673c1b8dae011b41263c9

Contents?: true

Size: 520 Bytes

Versions: 5

Compression:

Stored size: 520 Bytes

Contents

# encoding: UTF-8

module CldrPlurals
  module Compiler
    class Emitter
      class << self

        protected

        def emit(obj)
          name = obj.class.name
            .split('::').last
            .gsub(/([a-z\d])([A-Z])/, '\1_\2')
            .downcase

          method_sym = :"emit_#{name}"

          if respond_to?(method_sym, true)
            send(method_sym, obj)
          end
        end

        def emit_all(*objs)
          objs.map { |obj| emit(obj) }
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cldr-plurals-1.2.0 lib/cldr-plurals/compiler/emitter.rb
cldr-plurals-1.1.1 lib/cldr-plurals/compiler/emitter.rb
cldr-plurals-1.1.0 lib/cldr-plurals/compiler/emitter.rb
cldr-plurals-1.0.1 lib/cldr-plurals/compiler/emitter.rb
cldr-plurals-1.0.0 lib/cldr-plurals/compiler/emitter.rb