Class: MonoclePrint::Rectangle

Inherits:
Struct
  • Object
show all
Defined in:
lib/monocle-print/geometry.rb,
lib/monocle-print/geometry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left = 0, top = left, right = left, bottom = top) ⇒ Rectangle

Returns a new instance of Rectangle.



62
63
64
# File 'lib/monocle-print/geometry.rb', line 62

def initialize( left = 0, top = left, right = left, bottom = top )
  super( left, top, right, bottom )
end

Instance Attribute Details

#bottomObject

Returns the value of attribute bottom

Returns:

  • (Object)

    the current value of bottom



52
53
54
# File 'lib/monocle-print/geometry.rb', line 52

def bottom
  @bottom
end

#leftObject

Returns the value of attribute left

Returns:

  • (Object)

    the current value of left



52
53
54
# File 'lib/monocle-print/geometry.rb', line 52

def left
  @left
end

#rightObject

Returns the value of attribute right

Returns:

  • (Object)

    the current value of right



52
53
54
# File 'lib/monocle-print/geometry.rb', line 52

def right
  @right
end

#topObject

Returns the value of attribute top

Returns:

  • (Object)

    the current value of top



52
53
54
# File 'lib/monocle-print/geometry.rb', line 52

def top
  @top
end

Class Method Details

.create(params) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/monocle-print/geometry.rb', line 54

def self.create( params )
  left   = params.fetch( :left, 0 )
  right  = params.fetch( :right, left )
  top    = params.fetch( :top, left )
  bottom = params.fetch( :bottom, top )
  new( left, top, right, bottom )
end