Sha256: fed871496df02555c0a5af9e91634fa519cca392ac10ea697833785acc4b3035
Contents?: true
Size: 587 Bytes
Versions: 24
Compression:
Stored size: 587 Bytes
Contents
require "ostruct" module Frank module Cucumber class Rect attr_reader :x, :y, :width, :height def self.from_api_repr( hash ) x,y = hash["origin"]["x"], hash["origin"]["y"] width,height = hash["size"]["width"],hash["size"]["height"] self.new( x, y, width, height ) end def initialize(x,y,width,height) @x,@y,@width,@height = x,y,width,height end def center OpenStruct.new( :x => @x.to_f + (@width.to_f/2), :y => @y.to_f + (@height.to_f/2) ) end end end end
Version data entries
24 entries across 24 versions & 4 rubygems