Sha256: c5b01bc6b3bc379d21128071b4cc49af8cf74b1ee5cd76e43e343ad96dcddc03

Contents?: true

Size: 525 Bytes

Versions: 1

Compression:

Stored size: 525 Bytes

Contents

# Stupid but really useful class:
# Inherits from SymbolTable (https://github.com/mjijackson/symboltable), but when it is initialized
# it simply... well, recursively converts all Hashes into dictionaries
module G11n
  class Dictionary < SymbolTable
    
    def initialize *args
      super *args
      _symbolize!
    end
    
    private
      def _symbolize!
        each_key do |key|
          if self[key].instance_of? Hash
            self[key] = Dictionary.new self[key]
          end
        end
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
g11n-0.0.1 lib/g11n/dictionary.rb