class Monotony::Square

Represents any landable square on the board.

Attributes

action[RW]
colour[RW]
name[RW]
owner[RW]
set[RW]

@return [Symbol] Returns the name of the set containing this property.

Public Class Methods

new(opts) click to toggle source

@param [Hash] opts @option opts [Symbol] :set a symbol identifying this property as a member of a set of properties. @option opts [String] :name the name of the property. @option opts [Proc] :action a procedure to run when a player lands on this square. @option opts [Symbol] :colour the colour to use when rendering this square on a GUI.

# File lib/monotony/square.rb, line 15
def initialize(opts)
        @owner = nil
        @set = opts[:set] || nil
        @name = opts[:name]
        @action = opts[:action] || Proc.new {|game, owner, player, property|}
        @colour = opts[:colour] || ( String.colors.include? opts[:set] ? opts[:set] : :light_black )
end