Sha256: a4faab69d354b5048eb59d86196da91c9ef2a5e64b5be883415f6af2accc9600

Contents?: true

Size: 318 Bytes

Versions: 3

Compression:

Stored size: 318 Bytes

Contents

# -*- encoding : utf-8 -*-

module Phrase::Extensions::String
  extend ActiveSupport::Concern
  
  module InstanceMethods
    def expand_to_hash(value=nil)
      self.split('.').reverse.inject(value) do |hash, item|
        {item => hash}
      end
    end
  end
end

String.send(:include, Phrase::Extensions::String)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phrase-0.1.2 lib/phrase/extensions/string.rb
phrase-0.1.1 lib/phrase/extensions/string.rb
phrase-0.1 lib/phrase/extensions/string.rb