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

Version Path
sc-frank-ios-1.2.3 lib/frank-cucumber/rect.rb
frank-cucumber-1.2.5 lib/frank-cucumber/rect.rb
frank-cucumber-1.2.4.pre1 lib/frank-cucumber/rect.rb
frank-pivotal-1.3.0.pre.2 lib/frank-pivotal/rect.rb
sc-frank-cucumber-1.2.1.bba52d7.debug lib/frank-cucumber/rect.rb
sc-frank-cucumber-1.2.1.e1e3ccb.debug lib/frank-cucumber/rect.rb
sc-frank-cucumber-1.2.1.1a856ca.debug lib/frank-cucumber/rect.rb
frank-pivotal-1.3.0.pre.1 lib/frank-pivotal/rect.rb
frank-pivotal-1.2.4 lib/frank-pivotal/rect.rb
frank-pivotal-1.2.3.pre.2 lib/frank-pivotal/rect.rb
frank-pivotal-1.2.3.pre.1 lib/frank-pivotal/rect.rb
frank-pivotal-1.2.3 lib/frank-pivotal/rect.rb
sc-frank-cucumber-1.2.1.b7791c5.debug lib/frank-cucumber/rect.rb
frank-cucumber-1.2.3 lib/frank-cucumber/rect.rb
sc-frank-cucumber-1.2.1.3256dc1.debug lib/frank-cucumber/rect.rb
sc-frank-cucumber-1.2.1.9c95c03.debug lib/frank-cucumber/rect.rb
sc-frank-cucumber-1.2.1.1dcc760.debug lib/frank-cucumber/rect.rb
frank-cucumber-1.2.2 lib/frank-cucumber/rect.rb
sc-frank-cucumber-1.2.1.1dcc760 lib/frank-cucumber/rect.rb
frank-cucumber-1.2.1 lib/frank-cucumber/rect.rb