Sha256: bc953ff80744d1b7d88fedab20ec24e28b64a2263131ea7834f643a19f168bab

Contents?: true

Size: 470 Bytes

Versions: 8

Compression:

Stored size: 470 Bytes

Contents

class SugarPNG
  class Border
    attr_accessor :left, :right, :top, :bottom, :color
    def initialize h
      @color = h[:color] || raise(ArgumentError.new("border color must be set"))
      @left  = (h[:left]  || h[:size]).to_i
      @right = (h[:right] || h[:size]).to_i
      @top   = (h[:top]   || h[:size]).to_i
      @bottom= (h[:bottom]|| h[:size]).to_i
    end

    def width
      @left + @right
    end

    def height
      @top + @bottom
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sugar_png-0.5.5 lib/sugar_png/border.rb
sugar_png-0.5.4 lib/sugar_png/border.rb
sugar_png-0.5.3 lib/sugar_png/border.rb
sugar_png-0.5.2 lib/sugar_png/border.rb
sugar_png-0.5.1 lib/sugar_png/border.rb
sugar_png-0.5.0 lib/sugar_png/border.rb
sugar_png-0.4.1 lib/sugar_png/border.rb
sugar_png-0.4.0 lib/sugar_png/border.rb