Sha256: a516aa3fd28596764c3c51787486ed60a61a5ccde787ca26c59f39948b4fe843

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

# encoding: UTF-8

module TwitterCldr
  module Tokenizers
    class KeyPath
      class << self
        def dirname(path)
          self.join_path(self.split_path(path)[0..-2])
        end

        def join(*args)
          final = ""
          args.each do |arg|
            fixed_arg = arg.chomp(".")
            fixed_arg = arg[1..-1] if fixed_arg[0].chr == "."
            final << "." if final.size > 0
            final << fixed_arg
          end
          final
        end

        def split_path(path)
          path.split(/\./)
        end

        def join_path(path_arr)
          path_arr.join(".")
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr-1.0.1 lib/tokenizers/key_path.rb