class Object
Public Instance Methods
hash_to_map(hash)
click to toggle source
# File lib/compass-svg-sprite/helpers.rb, line 30 def hash_to_map(hash) new_hash = Hash[hash.map{|key, value| [value_to_sass(key), value_to_sass(value)]}] return Sass::Script::Value::Map.new(new_hash) end
map_to_hash(map)
click to toggle source
# File lib/compass-svg-sprite/helpers.rb, line 1 def map_to_hash(map) hash = Hash.new map.value.each do |key, value| case value.class.name when 'Sass::Script::Value::Map' hash[key.value] = map_to_hash(value) when 'Sass::Script::Value::Color' hash[key.value] = value.to_s else hash[key.value] = value.value end end return hash end
value_to_sass(value)
click to toggle source
# File lib/compass-svg-sprite/helpers.rb, line 16 def value_to_sass(value) case value.class.name when 'String' sass_value = Sass::Script::Value::String.new(value) when 'Fixnum' sass_value = Sass::Script::Value::Number.new(value) when 'Float' sass_value = Sass::Script::Value::Number.new(value) when 'Hash' sass_value = hash_to_map(value) end return sass_value end