Class: Samscript::WaitMatcher
- Inherits:
-
Object
- Object
- Samscript::WaitMatcher
- Defined in:
- lib/samscript/wait_matcher.rb
Class Method Summary collapse
- .parse_colour(params) ⇒ Object
- .parse_location(params) ⇒ Object
- .validate_wait_params(params) ⇒ Object
Class Method Details
.parse_colour(params) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# 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) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# 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) ⇒ Object
7 8 9 |
# File 'lib/samscript/wait_matcher.rb', line 7 def self.validate_wait_params params raise "no params" if params.empty? end |