Class: Plushie::Canvas::Shape::LinearGradient
- Inherits:
-
Data
- Object
- Data
- Plushie::Canvas::Shape::LinearGradient
- Defined in:
- lib/plushie/canvas/shape/linear_gradient.rb
Overview
Linear gradient descriptor usable as a canvas fill value.
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#stops ⇒ Object
readonly
Returns the value of attribute stops.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Backward-compatible hash-style access.
-
#initialize(from:, to:, stops:) ⇒ LinearGradient
constructor
A new instance of LinearGradient.
-
#to_wire ⇒ Hash
Wire-ready gradient map.
Constructor Details
#initialize(from:, to:, stops:) ⇒ LinearGradient
Returns a new instance of LinearGradient.
12 13 14 |
# File 'lib/plushie/canvas/shape/linear_gradient.rb', line 12 def initialize(from:, to:, stops:) super end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from
11 12 13 |
# File 'lib/plushie/canvas/shape/linear_gradient.rb', line 11 def from @from end |
#stops ⇒ Object (readonly)
Returns the value of attribute stops
11 12 13 |
# File 'lib/plushie/canvas/shape/linear_gradient.rb', line 11 def stops @stops end |
#to ⇒ Object (readonly)
Returns the value of attribute to
11 12 13 |
# File 'lib/plushie/canvas/shape/linear_gradient.rb', line 11 def to @to end |
Instance Method Details
#[](key) ⇒ Object
Backward-compatible hash-style access.
17 |
# File 'lib/plushie/canvas/shape/linear_gradient.rb', line 17 def [](key) = to_wire[key] |
#to_wire ⇒ Hash
Returns wire-ready gradient map.
20 21 22 |
# File 'lib/plushie/canvas/shape/linear_gradient.rb', line 20 def to_wire {type: "linear", start: from, end: to, stops: stops} end |