Class: Dawg::Word
- Inherits:
-
Object
- Object
- Dawg::Word
- Defined in:
- lib/dawg/word.rb
Instance Attribute Summary collapse
-
#final ⇒ Object
Returns the value of attribute final.
-
#word ⇒ Object
Returns the value of attribute word.
Instance Method Summary collapse
- #+(other) ⇒ Object
-
#initialize(word = '', final = false) ⇒ Word
constructor
A new instance of Word.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(word = '', final = false) ⇒ Word
Returns a new instance of Word.
5 6 7 8 |
# File 'lib/dawg/word.rb', line 5 def initialize( word = '', final = false) @word = word @final = final end |
Instance Attribute Details
#final ⇒ Object
Returns the value of attribute final.
3 4 5 |
# File 'lib/dawg/word.rb', line 3 def final @final end |
#word ⇒ Object
Returns the value of attribute word.
3 4 5 |
# File 'lib/dawg/word.rb', line 3 def word @word end |
Instance Method Details
#+(other) ⇒ Object
10 11 12 |
# File 'lib/dawg/word.rb', line 10 def +(other) Word.new(@word + other.word, other.final) end |
#inspect ⇒ Object
18 19 20 |
# File 'lib/dawg/word.rb', line 18 def inspect @word end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/dawg/word.rb', line 14 def to_s @word end |