Class: Codebreaker::Sorter
- Inherits:
-
Object
- Object
- Codebreaker::Sorter
- Defined in:
- lib/codebreaker/sorter.rb
Constant Summary collapse
- CONDITIONAL_ARRAY =
i[hell medium easy].freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(data) ⇒ Sorter
constructor
A new instance of Sorter.
Constructor Details
#initialize(data) ⇒ Sorter
Returns a new instance of Sorter.
9 10 11 |
# File 'lib/codebreaker/sorter.rb', line 9 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/codebreaker/sorter.rb', line 7 def data @data end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 |
# File 'lib/codebreaker/sorter.rb', line 13 def call sorted = sort_by_hints(data) sorted = sort_by_attempts(sorted) sorted = sort_by_difficulties(sorted) sorted end |