Class: Plushie::Type::Shadow::Spec
- Inherits:
-
Data
- Object
- Data
- Plushie::Type::Shadow::Spec
- Defined in:
- lib/plushie/type/shadow.rb
Overview
Immutable spec; use #with to create modified copies.
Instance Attribute Summary collapse
-
#blur_radius ⇒ Object
readonly
Returns the value of attribute blur_radius.
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#offset_x ⇒ Object
readonly
Returns the value of attribute offset_x.
-
#offset_y ⇒ Object
readonly
Returns the value of attribute offset_y.
Instance Method Summary collapse
-
#initialize(color: "#000000", offset_x: 0, offset_y: 0, blur_radius: 0) ⇒ Spec
constructor
A new instance of Spec.
-
#to_wire ⇒ Hash
Wire-ready map.
-
#with(**changes) ⇒ Object
Returns a copy with the given fields updated.
Constructor Details
#initialize(color: "#000000", offset_x: 0, offset_y: 0, blur_radius: 0) ⇒ Spec
Returns a new instance of Spec.
23 24 25 |
# File 'lib/plushie/type/shadow.rb', line 23 def initialize(color: "#000000", offset_x: 0, offset_y: 0, blur_radius: 0) super end |
Instance Attribute Details
#blur_radius ⇒ Object (readonly)
Returns the value of attribute blur_radius
22 23 24 |
# File 'lib/plushie/type/shadow.rb', line 22 def blur_radius @blur_radius end |
#color ⇒ Object (readonly)
Returns the value of attribute color
22 23 24 |
# File 'lib/plushie/type/shadow.rb', line 22 def color @color end |
#offset_x ⇒ Object (readonly)
Returns the value of attribute offset_x
22 23 24 |
# File 'lib/plushie/type/shadow.rb', line 22 def offset_x @offset_x end |
#offset_y ⇒ Object (readonly)
Returns the value of attribute offset_y
22 23 24 |
# File 'lib/plushie/type/shadow.rb', line 22 def offset_y @offset_y end |
Instance Method Details
#to_wire ⇒ Hash
Returns wire-ready map.
33 34 35 |
# File 'lib/plushie/type/shadow.rb', line 33 def to_wire {color: color, offset: [offset_x, offset_y], blur_radius: blur_radius} end |
#with(**changes) ⇒ Object
Returns a copy with the given fields updated.
28 29 30 |
# File 'lib/plushie/type/shadow.rb', line 28 def with(**changes) self.class.new(**to_h.merge(changes)) end |