Class: Pangrid::Rebus
- Inherits:
-
Object
- Object
- Pangrid::Rebus
- Defined in:
- lib/pangrid/xw.rb
Overview
symbol: the symbol representing the solution in the grid
(populated by xword.encode_rebus!)
solution: the word the symbol represents display_char: optional character representation of a rebus square
Instance Attribute Summary collapse
-
#display_char ⇒ Object
Returns the value of attribute display_char.
-
#solution ⇒ Object
Returns the value of attribute solution.
-
#symbol ⇒ Object
Returns the value of attribute symbol.
Instance Method Summary collapse
-
#initialize(str, char = nil) ⇒ Rebus
constructor
A new instance of Rebus.
- #inspect ⇒ Object
- #to_char ⇒ Object
Constructor Details
#initialize(str, char = nil) ⇒ Rebus
Returns a new instance of Rebus.
15 16 17 18 19 |
# File 'lib/pangrid/xw.rb', line 15 def initialize(str, char = nil) @symbol = nil @solution = str @display_char = char || str[0] end |
Instance Attribute Details
#display_char ⇒ Object
Returns the value of attribute display_char.
13 14 15 |
# File 'lib/pangrid/xw.rb', line 13 def display_char @display_char end |
#solution ⇒ Object
Returns the value of attribute solution.
13 14 15 |
# File 'lib/pangrid/xw.rb', line 13 def solution @solution end |
#symbol ⇒ Object
Returns the value of attribute symbol.
13 14 15 |
# File 'lib/pangrid/xw.rb', line 13 def symbol @symbol end |
Instance Method Details
#inspect ⇒ Object
25 26 27 |
# File 'lib/pangrid/xw.rb', line 25 def inspect "[#{symbol}|#{solution}]" end |
#to_char ⇒ Object
21 22 23 |
# File 'lib/pangrid/xw.rb', line 21 def to_char symbol || display_char end |