Class: Pressletter::Shell::CLI

Inherits:
Object
  • Object
show all
Includes:
Core
Defined in:
lib/pressletter/shell/cli.rb

Instance Method Summary collapse

Methods included from Core

#create_letters, #find_words, #load_dictionary, #print_words, #solve, #sort_words

Constructor Details

#initialize(config = Pressletter::default_config, reads_input = ReadsInput.new, writes_output = WritesOutput.new) ⇒ CLI

Returns a new instance of CLI.



5
6
7
8
9
# File 'lib/pressletter/shell/cli.rb', line 5

def initialize(config = Pressletter::default_config, reads_input = ReadsInput.new, writes_output = WritesOutput.new)
  @config = config
  @reads_input = reads_input
  @writes_output = writes_output
end

Instance Method Details

#mainObject



11
12
13
# File 'lib/pressletter/shell/cli.rb', line 11

def main
  @writes_output.write(print_words(solve(@config, create_letters(@reads_input.read))))
end