Class: Dictionary
- Inherits:
-
Object
- Object
- Dictionary
- Defined in:
- lib/dictionary.rb
Overview
Class to model Dictionary
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
-
#initialize(filename) ⇒ Dictionary
constructor
A new instance of Dictionary.
- #word ⇒ Object
Constructor Details
#initialize(filename) ⇒ Dictionary
Returns a new instance of Dictionary.
7 8 9 |
# File 'lib/dictionary.rb', line 7 def initialize(filename) @filename = filename end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
5 6 7 |
# File 'lib/dictionary.rb', line 5 def filename @filename end |
Instance Method Details
#word ⇒ Object
11 12 13 |
# File 'lib/dictionary.rb', line 11 def word @word ||= words.sample.downcase end |