Class: Dawg::Word

Inherits:
Object
  • Object
show all
Defined in:
lib/dawg/word.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#finalObject

Returns the value of attribute final.



3
4
5
# File 'lib/dawg/word.rb', line 3

def final
  @final
end

#wordObject

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

#inspectObject



18
19
20
# File 'lib/dawg/word.rb', line 18

def inspect
  @word
end

#to_sObject



14
15
16
# File 'lib/dawg/word.rb', line 14

def to_s
  @word
end