class Compass::Core::SassExtensions::Functions::GradientSupport::RadialGradient
Attributes
color_stops[RW]
position[RW]
shape_and_size[RW]
Public Class Methods
new(position, shape_and_size, color_stops)
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 280 def initialize(position, shape_and_size, color_stops) unless color_stops.value.size >= 2 raise Sass::SyntaxError, "At least two color stops are required for a radial-gradient" end if angle?(position) raise Sass::SyntaxError, "CSS no longer allows angles in radial-gradients." end self.position = position self.shape_and_size = shape_and_size self.color_stops = color_stops end
Public Instance Methods
array_to_s(array, opts)
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 362 def array_to_s(array, opts) if array.is_a?(Sass::Script::Value::List) array.to_s else l = list(array, :space) l.options = opts l.to_s end end
children()
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 276 def children [color_stops, position, shape_and_size].compact end
new_standard_arguments(options = self.options)
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 333 def new_standard_arguments(options = self.options) if shape_and_size "#{array_to_s(shape_and_size, options)} at #{array_to_s(position, options)}, #{array_to_s(color_stops, options)}" elsif position "#{array_to_s(position, options)}, #{array_to_s(color_stops, options)}" else array_to_s(color_stops, options) end end
old_standard_arguments(options = self.options)
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 343 def old_standard_arguments(options = self.options) if shape_and_size "#{array_to_s(position, options)}, #{array_to_s(shape_and_size, options)}, #{array_to_s(color_stops, options)}" elsif position "#{array_to_s(position, options)}, #{array_to_s(color_stops, options)}" else array_to_s(color_stops, options) end end
supports?(aspect)
click to toggle source
Calls superclass method
Compass::Core::SassExtensions::Functions::GradientSupport::Gradient#supports?
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 300 def supports?(aspect) # I don't know how to support radial old webkit gradients (owg) if %w(owg).include?(aspect) false else super end end
to_css2(options = self.options)
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 358 def to_css2(options = self.options) null end
to_moz(options = self.options)
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 319 def to_moz(options = self.options) s = "-moz-radial-gradient(" s << old_standard_arguments(options) s << ")" identifier(s) end
to_official()
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 326 def to_official s = "radial-gradient(" s << new_standard_arguments(options) s << ")" identifier(s) end
to_s(options = self.options)
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 292 def to_s(options = self.options) to_official.to_s end
to_s_prefixed(options = self.options)
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 296 def to_s_prefixed(options = self.options) to_s(options) end
to_svg(options = self.options)
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 353 def to_svg(options = self.options) # XXX Add shape support if possible radial_svg_gradient(color_stops, position || _center_position) end
to_webkit(options = self.options)
click to toggle source
# File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 312 def to_webkit(options = self.options) s = "-webkit-radial-gradient(" s << old_standard_arguments(options) s << ")" identifier(s) end