Class: WordSearch::Generator::Base
- Inherits:
-
Object
- Object
- WordSearch::Generator::Base
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/word_search/generator/base.rb
Instance Attribute Summary collapse
-
#plane ⇒ Object
Returns the value of attribute plane.
-
#positions ⇒ Object
Returns the value of attribute positions.
-
#used_coordinates ⇒ Object
Returns the value of attribute used_coordinates.
-
#word_bank ⇒ Object
Returns the value of attribute word_bank.
Instance Method Summary collapse
- #directions ⇒ Object
-
#initialize(plane, word_bank) ⇒ Base
constructor
A new instance of Base.
- #perform ⇒ Object
Constructor Details
#initialize(plane, word_bank) ⇒ Base
Returns a new instance of Base.
15 16 17 18 19 20 |
# File 'lib/word_search/generator/base.rb', line 15 def initialize(plane, word_bank) @plane = plane @word_bank = word_bank @used_coordinates = [] @positions = {} end |
Instance Attribute Details
#plane ⇒ Object
Returns the value of attribute plane.
8 9 10 |
# File 'lib/word_search/generator/base.rb', line 8 def plane @plane end |
#positions ⇒ Object
Returns the value of attribute positions.
8 9 10 |
# File 'lib/word_search/generator/base.rb', line 8 def positions @positions end |
#used_coordinates ⇒ Object
Returns the value of attribute used_coordinates.
8 9 10 |
# File 'lib/word_search/generator/base.rb', line 8 def used_coordinates @used_coordinates end |
#word_bank ⇒ Object
Returns the value of attribute word_bank.
8 9 10 |
# File 'lib/word_search/generator/base.rb', line 8 def word_bank @word_bank end |
Instance Method Details
#directions ⇒ Object
11 12 13 |
# File 'lib/word_search/generator/base.rb', line 11 def directions raise NotImplementedError end |
#perform ⇒ Object
22 23 24 25 26 |
# File 'lib/word_search/generator/base.rb', line 22 def perform word_bank.each do |word| @positions[word] = place_word(word) end end |