Class: Rubipara::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/rubipara/cli.rb

Instance Method Summary collapse

Instance Method Details

#character(name = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rubipara/cli.rb', line 13

def character(name = nil)
  if name
    begin
      character = Rubipara::Character.new(name)
      puts_character_profile character
    rescue Rubipara::Character::NotFoundError => e
      puts e.message
    end
  else
    Rubipara::Character.all.each {|character| puts_character_name character }
  end
end

#episode(episode_num = nil) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/rubipara/cli.rb', line 32

def episode(episode_num = nil)
  if episode_num
    begin
      episode = Rubipara::Episode.new(episode_num)
      puts_episode_info episode
    rescue Rubipara::Episode::NotFoundError => e
      puts e.message
    end
  else
    Rubipara::Episode.all.each {|episode| puts_episode_info episode }
  end
end

#kashikoma(word = 'Kashikoma!') ⇒ Object



7
8
9
10
# File 'lib/rubipara/cli.rb', line 7

def kashikoma(word = 'Kashikoma!')
  kashikoma = Rubipara::AA.new(:kashikoma, word: word)
  puts_aa kashikoma
end

#profileObject



27
28
29
# File 'lib/rubipara/cli.rb', line 27

def profile
  Rubipara::Character.all.each {|character| puts_character_profile character }
end