Class: TypeMapper
- Inherits:
-
Object
- Object
- TypeMapper
- Defined in:
- lib/typemapper.rb
Instance Method Summary collapse
Instance Method Details
#to_map(str) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/typemapper.rb', line 3 def to_map str raise 'Nil map string' unless str raise 'Empty map string' if str.length == 0 map = Hash.new str.split(",").each {|pair| split_pair = pair.split(":", 2) k = split_pair[0] v = split_pair[1] map[k] = v } map end |