Class: WordSearch::Plane::Base

Inherits:
Hash
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/word_search/plane/base.rb

Constant Summary collapse

LETTERS =
("a".."z").to_a

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#catalogObject

Returns the value of attribute catalog.



10
11
12
# File 'lib/word_search/plane/base.rb', line 10

def catalog
  @catalog
end

#xObject

Returns the value of attribute x.



10
11
12
# File 'lib/word_search/plane/base.rb', line 10

def x
  @x
end

#yObject

Returns the value of attribute y.



10
11
12
# File 'lib/word_search/plane/base.rb', line 10

def y
  @y
end

Instance Method Details

#add_lettersObject



30
31
32
33
34
35
36
# File 'lib/word_search/plane/base.rb', line 30

def add_letters
  x.times do |x_point|
    y.times do |y_point|
      yield(x_point, y_point)
    end
  end
end

#directionsObject

Raises:

  • (NotImplementedError)


54
55
56
# File 'lib/word_search/plane/base.rb', line 54

def directions
  raise NotImplementedError
end

#letter_at(*positions) ⇒ Object



58
59
60
# File 'lib/word_search/plane/base.rb', line 58

def letter_at(*positions)
  dig(*positions)
end

#maxObject

Raises:

  • (NotImplementedError)


50
51
52
# File 'lib/word_search/plane/base.rb', line 50

def max
  raise NotImplementedError
end


14
15
16
# File 'lib/word_search/plane/base.rb', line 14

def print(file_name = nil)
  File.open(file_name || "word_search", "w") { |f| f.write to_s }
end

#pto_sObject



38
39
40
# File 'lib/word_search/plane/base.rb', line 38

def pto_s
  puts to_s
end

#random_letterObject



18
19
20
# File 'lib/word_search/plane/base.rb', line 18

def random_letter
  LETTERS.sample
end

#three_dimensional?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/word_search/plane/base.rb', line 26

def three_dimensional?
  false
end

#to_sObject

Raises:

  • (NotImplementedError)


42
43
44
# File 'lib/word_search/plane/base.rb', line 42

def to_s
  raise NotImplementedError
end

#total_pointsObject

Raises:

  • (NotImplementedError)


46
47
48
# File 'lib/word_search/plane/base.rb', line 46

def total_points
  raise NotImplementedError
end

#two_dimensional?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/word_search/plane/base.rb', line 22

def two_dimensional?
  true
end