Class: Plushie::Type::Padding::Pad
- Inherits:
-
Data
- Object
- Data
- Plushie::Type::Padding::Pad
- Defined in:
- lib/plushie/type/padding.rb
Overview
Immutable spec; use #with to create modified copies.
Instance Attribute Summary collapse
-
#bottom ⇒ Object
readonly
Returns the value of attribute bottom.
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
-
#top ⇒ Object
readonly
Returns the value of attribute top.
Instance Method Summary collapse
-
#initialize(top: nil, right: nil, bottom: nil, left: nil) ⇒ Pad
constructor
A new instance of Pad.
-
#to_wire ⇒ Hash
Wire-ready hash with nil fields stripped.
Constructor Details
#initialize(top: nil, right: nil, bottom: nil, left: nil) ⇒ Pad
Returns a new instance of Pad.
24 25 26 |
# File 'lib/plushie/type/padding.rb', line 24 def initialize(top: nil, right: nil, bottom: nil, left: nil) super end |
Instance Attribute Details
#bottom ⇒ Object (readonly)
Returns the value of attribute bottom
23 24 25 |
# File 'lib/plushie/type/padding.rb', line 23 def bottom @bottom end |
#left ⇒ Object (readonly)
Returns the value of attribute left
23 24 25 |
# File 'lib/plushie/type/padding.rb', line 23 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right
23 24 25 |
# File 'lib/plushie/type/padding.rb', line 23 def right @right end |
#top ⇒ Object (readonly)
Returns the value of attribute top
23 24 25 |
# File 'lib/plushie/type/padding.rb', line 23 def top @top end |
Instance Method Details
#to_wire ⇒ Hash
Returns wire-ready hash with nil fields stripped.
29 30 31 32 33 34 35 36 |
# File 'lib/plushie/type/padding.rb', line 29 def to_wire h = {} h[:top] = top unless top.nil? h[:right] = right unless right.nil? h[:bottom] = bottom unless bottom.nil? h[:left] = left unless left.nil? h end |