Sha256: 36817474980a9c15a3fd404cc1a93fcd880a24cb9b677e4403586214ded3faf8

Contents?: true

Size: 580 Bytes

Versions: 11

Compression:

Stored size: 580 Bytes

Contents

module Sample
  class Shape
    include HasProps

    attr_accessor :bounds
    attr_accessor :color
    attr_accessor :border, :border_color

    def initialize(left, top, wide, high, color=nil)
      @bounds = [[left, top], [left + wide, top + high]]
      @color = color
      @border = 1
      @border_color = :black
    end
    
    def left
      @bounds[0][0]
    end
    
    def top
      @bounds[0][1]
    end
    
    def width
      @bounds[1][0] - @bounds[0][0]
    end
    
    def height
      @bounds[1][1] - @bounds[0][1]
    end
    
  end # Shape
end # Sample

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
oj-3.16.7 test/sample/shape.rb
oj-3.16.6 test/sample/shape.rb
oj-3.16.5 test/sample/shape.rb
oj-3.16.4 test/sample/shape.rb
oj-3.16.3 test/sample/shape.rb
oj-3.16.2 test/sample/shape.rb
oj-3.16.1 test/sample/shape.rb
oj-3.16.0 test/sample/shape.rb
oj-3.15.1 test/sample/shape.rb
oj-3.15.0 test/sample/shape.rb
oj-3.14.3 test/sample/shape.rb