Class: Monotony::Square
- Inherits:
-
Object
- Object
- Monotony::Square
- Defined in:
- lib/monotony/square.rb
Overview
Represents any landable square on the board.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#colour ⇒ Object
Returns the value of attribute colour.
-
#name ⇒ Object
Returns the value of attribute name.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#set ⇒ Symbol
Returns the name of the set containing this property.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Square
constructor
A new instance of Square.
Constructor Details
#initialize(opts) ⇒ Square
Returns a new instance of Square.
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 |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
5 6 7 |
# File 'lib/monotony/square.rb', line 5 def action @action end |
#colour ⇒ Object
Returns the value of attribute colour.
5 6 7 |
# File 'lib/monotony/square.rb', line 5 def colour @colour end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/monotony/square.rb', line 5 def name @name end |
#owner ⇒ Object
Returns the value of attribute owner.
5 6 7 |
# File 'lib/monotony/square.rb', line 5 def owner @owner end |
#set ⇒ Symbol
Returns the name of the set containing this property.
8 9 10 |
# File 'lib/monotony/square.rb', line 8 def set @set end |