Class: Plushie::Type::Padding::Pad

Inherits:
Data
  • Object
show all
Defined in:
lib/plushie/type/padding.rb

Overview

Immutable spec; use #with to create modified copies.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bottomObject (readonly)

Returns the value of attribute bottom

Returns:

  • (Object)

    the current value of bottom



23
24
25
# File 'lib/plushie/type/padding.rb', line 23

def bottom
  @bottom
end

#leftObject (readonly)

Returns the value of attribute left

Returns:

  • (Object)

    the current value of left



23
24
25
# File 'lib/plushie/type/padding.rb', line 23

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right

Returns:

  • (Object)

    the current value of right



23
24
25
# File 'lib/plushie/type/padding.rb', line 23

def right
  @right
end

#topObject (readonly)

Returns the value of attribute top

Returns:

  • (Object)

    the current value of top



23
24
25
# File 'lib/plushie/type/padding.rb', line 23

def top
  @top
end

Instance Method Details

#to_wireHash

Returns wire-ready hash with nil fields stripped.

Returns:

  • (Hash)

    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