class Sass::Embedded::Host::ValueProtofier
def from_proto(proto)
def from_proto(proto) oneof = proto.value obj = proto.public_send(oneof) case oneof when :string Sass::Value::String.new( obj.text, quoted: obj.quoted ) when :number Sass::Value::Number.new( obj.value, { numerator_units: obj.numerators.to_a, denominator_units: obj.denominators.to_a } ) when :rgb_color Sass::Value::Color.new( red: obj.red, green: obj.green, blue: obj.blue, alpha: obj.alpha ) when :hsl_color Sass::Value::Color.new( hue: obj.hue, saturation: obj.saturation, lightness: obj.lightness, alpha: obj.alpha ) when :hwb_color Sass::Value::Color.new( hue: obj.hue, whiteness: obj.whiteness, blackness: obj.blackness, alpha: obj.alpha ) when :argument_list Sass::Value::ArgumentList.new( obj.contents.map do |element| from_proto(element) end, obj.keywords.entries.to_h do |entry| [entry.first, from_proto(entry.last)] end, ListSeparator.from_proto(obj.separator) ).instance_eval do @id = obj.id self end when :list Sass::Value::List.new( obj.contents.map do |element| from_proto(element) end, separator: ListSeparator.from_proto(obj.separator), bracketed: obj.has_brackets ) when :map Sass::Value::Map.new( obj.entries.to_h do |entry| [from_proto(entry.key), from_proto(entry.value)] end ) when :compiler_function Sass::Value::Function.new(obj.id) when :host_function raise ProtocolError, 'The compiler may not send Value.host_function to host' when :singleton case obj when :TRUE Sass::Value::Boolean::TRUE when :FALSE Sass::Value::Boolean::FALSE when :NULL Sass::Value::Null::NULL else raise Sass::ScriptError, "Unknown Value.singleton #{obj}" end else raise Sass::ScriptError, "Unknown Value.value #{obj}" end end