Class: Gradient::Map
- Inherits:
-
Object
- Object
- Gradient::Map
- Defined in:
- lib/gradient/map.rb
Instance Attribute Summary collapse
-
#color_points ⇒ Object
readonly
Returns the value of attribute color_points.
-
#opacity_points ⇒ Object
readonly
Returns the value of attribute opacity_points.
-
#points ⇒ Object
readonly
Returns the value of attribute points.
Instance Method Summary collapse
-
#initialize(color_points = [], opacity_points = []) ⇒ Map
constructor
A new instance of Map.
- #inspect ⇒ Object
- #to_css(**args) ⇒ Object
Constructor Details
#initialize(color_points = [], opacity_points = []) ⇒ Map
Returns a new instance of Map.
6 7 8 9 10 11 12 |
# File 'lib/gradient/map.rb', line 6 def initialize(color_points=[], opacity_points=[]) @color_points = sort_points(Array(color_points)) @opacity_points = sort_points(Array(opacity_points)) @all_points = sort_points(@color_points + @opacity_points) @locations = @all_points.map { |point| point.location }.uniq @points ||= end |
Instance Attribute Details
#color_points ⇒ Object (readonly)
Returns the value of attribute color_points.
4 5 6 |
# File 'lib/gradient/map.rb', line 4 def color_points @color_points end |
#opacity_points ⇒ Object (readonly)
Returns the value of attribute opacity_points.
4 5 6 |
# File 'lib/gradient/map.rb', line 4 def opacity_points @opacity_points end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
4 5 6 |
# File 'lib/gradient/map.rb', line 4 def points @points end |
Instance Method Details
#inspect ⇒ Object
14 15 16 |
# File 'lib/gradient/map.rb', line 14 def inspect "#<Gradient Map #{points.map(&:inspect).join(" ")}>" end |
#to_css(**args) ⇒ Object
18 19 20 21 |
# File 'lib/gradient/map.rb', line 18 def to_css(**args) @css_printer ||= Gradient::CSSPrinter.new(self) @css_printer.css(**args) end |