Class: Compass::Core::SassExtensions::Functions::GradientSupport::RadialGradient
Constant Summary
Constants included
from Constants
Constants::POSITIONS
Sass::Script::Value::Base::NO_CHILDREN
Instance Attribute Summary collapse
Instance Method Summary
collapse
#inline_font_files, #inline_image
Methods included from Constants
#is_position, #is_position_list, #is_url, #opposite_position
Methods included from Functions
#_build_linear_gradient, #_linear_gradient, #_linear_gradient_legacy, #color_stops_in_percentages, #convert_angle_from_offical, #grad_color_stops, #grad_end_position, #grad_point, #grad_position, #linear_end_position, #linear_svg_gradient, #radial_gradient, #radial_svg_gradient, #reverse_side_or_corner
Methods included from Assertions
#assert_type
Methods included from Gradient
#angle?, #has_aspect?, included, #inspect, #is_position
#opts
Constructor Details
#initialize(position, shape_and_size, color_stops) ⇒ RadialGradient
Returns a new instance of RadialGradient.
280
281
282
283
284
285
286
287
288
289
290
|
# 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
|
Instance Attribute Details
#color_stops ⇒ Object
Returns the value of attribute color_stops.
274
275
276
|
# File 'lib/compass/core/sass_extensions/functions/gradient_support.rb', line 274
def color_stops
@color_stops
end
|
#position ⇒ Object
Returns the value of attribute position.
274
275
276
|
# File 'lib/compass/core/sass_extensions/functions/gradient_support.rb', line 274
def position
@position
end
|
#shape_and_size ⇒ Object
Returns the value of attribute shape_and_size.
274
275
276
|
# File 'lib/compass/core/sass_extensions/functions/gradient_support.rb', line 274
def shape_and_size
@shape_and_size
end
|
Instance Method Details
#array_to_s(array, opts) ⇒ Object
362
363
364
365
366
367
368
369
370
|
# 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 ⇒ Object
276
277
278
|
# 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) ⇒ Object
333
334
335
336
337
338
339
340
341
|
# 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) ⇒ Object
343
344
345
346
347
348
349
350
351
|
# 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) ⇒ Boolean
300
301
302
303
304
305
306
307
|
# File 'lib/compass/core/sass_extensions/functions/gradient_support.rb', line 300
def supports?(aspect)
if %w(owg).include?(aspect)
false
else
super
end
end
|
#to_css2(options = self.options) ⇒ Object
358
359
360
|
# 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) ⇒ Object
319
320
321
322
323
324
|
# 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 ⇒ Object
326
327
328
329
330
331
|
# 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) ⇒ Object
292
293
294
|
# 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) ⇒ Object
296
297
298
|
# 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) ⇒ Object
353
354
355
356
|
# File 'lib/compass/core/sass_extensions/functions/gradient_support.rb', line 353
def to_svg(options = self.options)
radial_svg_gradient(color_stops, position || _center_position)
end
|
#to_webkit(options = self.options) ⇒ Object
312
313
314
315
316
317
|
# 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
|