class Doku::SquareOnGrid
Represents a square on a grid. Any two instances with the same x and y coordinates are considered to be equal, which makes it convenient to use SquareOnGrid
instances as a key in a hash table. This class is used by the {PuzzleOnGrid} module to represent the {Puzzle.squares squares} in grid-based {Puzzle}s.
Public Instance Methods
matches?(conditions)
click to toggle source
:x or :y and the values are either Integers or Integer ranges.
@return (Boolean) True if the square matches all the conditions.
# File lib/doku/grid.rb, line 233 def matches?(conditions) conditions.all? { |property, values| values === send(property) } end
to_s()
click to toggle source
# File lib/doku/grid.rb, line 237 def to_s "Square(#{x}, #{y})" end