class ImageClipper::Geometry

Attributes

height[RW]
width[RW]

Public Class Methods

new(attrs) click to toggle source
# File lib/image_clipper/geometry.rb, line 7
def initialize(attrs)
        case attrs
        when String
                raise ArgumentError unless attrs.match(/^\w+x\w+$/)
                geo = attrs.split('x')
                @width = geo[0].to_i
                @height = geo[1].to_i
        when Hash
                @width = attrs[:width].to_i
                @height = attrs[:height].to_i
        end
end