Class: Hash

Inherits:
Object show all
Defined in:
lib/card/core_ext.rb

Class Method Summary collapse

Class Method Details

.new_from_semicolon_attr_list(attr_string) ⇒ Object



63
64
65
66
67
68
69
70
71
72
# File 'lib/card/core_ext.rb', line 63

def new_from_semicolon_attr_list(attr_string)
  return {} if attr_string.blank?
  attr_string.strip.split(';').inject({}) do |result, pair|
    value, key = pair.split(':').reverse
    key ||= 'view'
    key.strip!; value.strip!
    result[key.to_sym] = value
    result
  end
end