class Samscript::WaitMatcher

Public Class Methods

parse_colour(params) click to toggle source
# File lib/samscript/wait_matcher.rb, line 25
def self.parse_colour params
  labels = [:colour, :color]
  col = labels.reduce(nil) { |mem, sym| params[sym] || mem }

  case col
  when Color
    return col
  when Array
    return Color.new(col[0], col[1], col[2])
  end
end
parse_location(params) click to toggle source
# File lib/samscript/wait_matcher.rb, line 11
def self.parse_location params
  labels = [:at, :location, :coords, :point, :pixel]
  loc = labels.reduce(nil) { |mem, sym| params[sym] || mem }

  case loc
  when Vector
    return loc
  when Array
    return Vector[loc[0], loc[1]]
  when Point
    return Vector[loc.get_x, loc.get_y]
  end
end
validate_wait_params(params) click to toggle source
# File lib/samscript/wait_matcher.rb, line 7
def self.validate_wait_params params
  raise "no params" if params.empty?
end