Class: Griddle::Rectangle

Inherits:
Struct
  • Object
show all
Defined in:
lib/griddle/rectangle.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#heightObject

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



2
3
4
# File 'lib/griddle/rectangle.rb', line 2

def height
  @height
end

#leftObject

Returns the value of attribute left

Returns:

  • (Object)

    the current value of left



2
3
4
# File 'lib/griddle/rectangle.rb', line 2

def left
  @left
end

#topObject

Returns the value of attribute top

Returns:

  • (Object)

    the current value of top



2
3
4
# File 'lib/griddle/rectangle.rb', line 2

def top
  @top
end

#widthObject

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



2
3
4
# File 'lib/griddle/rectangle.rb', line 2

def width
  @width
end

Class Method Details

.create(top_left, bottom_right) ⇒ Object

include Comparable



5
6
7
# File 'lib/griddle/rectangle.rb', line 5

def self.create(top_left, bottom_right)
  top_left.to_rectangle(bottom_right)
end