Class: Gradient::Map
- Inherits:
-
Object
- Object
- Gradient::Map
- Defined in:
- lib/gradient/map.rb
Instance Attribute Summary collapse
-
#locations ⇒ Object
readonly
Returns the value of attribute locations.
-
#points ⇒ Object
readonly
Returns the value of attribute points.
Instance Method Summary collapse
-
#initialize(*points) ⇒ Map
constructor
A new instance of Map.
- #inspect ⇒ Object
- #to_css(**args) ⇒ Object
Constructor Details
#initialize(*points) ⇒ Map
Returns a new instance of Map.
6 7 8 9 |
# File 'lib/gradient/map.rb', line 6 def initialize(*points) @points = points.flatten.sort @locations = @points.map { |point| point.location } end |
Instance Attribute Details
#locations ⇒ Object (readonly)
Returns the value of attribute locations.
4 5 6 |
# File 'lib/gradient/map.rb', line 4 def locations @locations 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
11 12 13 |
# File 'lib/gradient/map.rb', line 11 def inspect "#<Gradient Map #{points.map(&:inspect).join(" ")}>" end |
#to_css(**args) ⇒ Object
15 16 17 18 |
# File 'lib/gradient/map.rb', line 15 def to_css(**args) @css_printer ||= Gradient::CSSPrinter.new(self) @css_printer.css(**args) end |