Method: Monotony::Square#initialize

Defined in:
lib/monotony/square.rb

#initialize(opts) ⇒ Square

Returns a new instance of Square.

Parameters:

  • opts (Hash)

Options Hash (opts):

  • :set (Symbol)

    a symbol identifying this property as a member of a set of properties.

  • :name (String)

    the name of the property.

  • :action (Proc)

    a procedure to run when a player lands on this square.

  • :colour (Symbol)

    the colour to use when rendering this square on a GUI.



15
16
17
18
19
20
21
# 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