File: point.rb

package info (click to toggle)
ruby-rghost 0.9.9-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,188 kB
  • sloc: ruby: 3,374; makefile: 6; sh: 1
file content (20 lines) | stat: -rw-r--r-- 409 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require "rghost/ps_object"
require "rghost/units"

# Creates one point using default unit defined in RGhost::Config::GS[:unit]
class RGhost::Point < RGhost::PsObject
  attr_accessor :x, :y

  def initialize(x, y)
    if x.is_a? Hash
      point = x
      @x, @y = point[:x], point[:y]
    else
      @x, @y = x, y
    end
  end

  def ps
    "#{RGhost::Units.parse(@x)} #{RGhost::Units.parse(@y)} "
  end
end