class Bake::Types::Hash

Public Class Methods

new(key_type, value_type) click to toggle source
# File lib/bake/types/hash.rb, line 30
def initialize(key_type, value_type)
        @key_type = key_type
        @value_type = value_type
end

Public Instance Methods

composite?() click to toggle source
# File lib/bake/types/hash.rb, line 35
def composite?
        true
end
parse(input) click to toggle source
# File lib/bake/types/hash.rb, line 39
def parse(input)
        hash = {}
        
        input.split(',').each do |pair|
                key, value = pair.split(':', 2)
                
                key = @key_type.parse(key)
                value = @value_type.parse(value)
                        
                hash[key] = value
        end
        
        return hash
end