Class: Codewars::TrainNext

Inherits:
Thor
  • Object
show all
Defined in:
lib/codewars/train_next.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ TrainNext

Returns a new instance of TrainNext.

Raises:

  • (Thor::Error)


3
4
5
6
7
8
9
10
11
12
13
# File 'lib/codewars/train_next.rb', line 3

def initialize(client)
  language = Configuration.option('language')
  raise Thor::Error, 'You should set an default language to use this command' unless language

  kata = client.train_next_kata(
    language: language.split(',').first,
    peek: 'true',
    strategy: 'default'
  )
  handle_next_kata(kata)
end