class SassC::Script::Value::Map
Attributes
to_h[R]
The Ruby hash containing the contents of this map. @return [Hash<Node, Node>]
value[R]
The Ruby hash containing the contents of this map. @return [Hash<Node, Node>]
Public Class Methods
new(hash)
click to toggle source
Creates a new map.
@param hash [Hash<Node, Node>]
Calls superclass method
SassC::Script::Value::new
# File lib/sassc/script/value/map.rb, line 13 def initialize(hash) super(hash) end
Public Instance Methods
eq(other)
click to toggle source
@see Value#eq
# File lib/sassc/script/value/map.rb, line 41 def eq(other) SassC::Script::Value::Bool.new(other.is_a?(Map) && value == other.value) end
hash()
click to toggle source
# File lib/sassc/script/value/map.rb, line 45 def hash @hash ||= value.hash end
options=(options)
click to toggle source
@see Value#options=
Calls superclass method
# File lib/sassc/script/value/map.rb, line 18 def options=(options) super value.each do |k, v| k.options = options v.options = options end end
separator()
click to toggle source
@see Value#separator
# File lib/sassc/script/value/map.rb, line 27 def separator :comma unless value.empty? end
to_a()
click to toggle source
@see Value#to_a
# File lib/sassc/script/value/map.rb, line 32 def to_a value.map do |k, v| list = SassC::Script::Value::List.new([k, v], separator: :space) list.options = options list end end
to_s(opts = {})
click to toggle source
@see Value#to_s
# File lib/sassc/script/value/map.rb, line 50 def to_s(opts = {}) raise SassC::SyntaxError.new("#{inspect} isn't a valid CSS value.") end
to_sass(opts = {})
click to toggle source
# File lib/sassc/script/value/map.rb, line 54 def to_sass(opts = {}) return "()" if value.empty? to_sass = lambda do |value| if value.is_a?(List) && value.separator == :comma "(#{value.to_sass(opts)})" else value.to_sass(opts) end end "(#{value.map {|(k, v)| "#{to_sass[k]}: #{to_sass[v]}"}.join(', ')})" end
Also aliased as: inspect