Class: Okao::CLI

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

Constant Summary collapse

OKAOS =
['(^-^)', '(´O`)', '(;-;)', '(´Д`)', '(。-_-。)', '(´・ω・`)', '(-_-;)', '(_ _)']

Instance Method Summary collapse

Instance Method Details

#exec(okao = nil) ⇒ Object



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

def exec(okao = nil)
  init_emoticon
  okao_text = load_file(options[:file_path])
  okao_text ||= okao

  code = okao_text.split("\n").reduce('') do |acc, cur|
    "#{acc}#{Okao::Parser.to_text(cur)}"
  end

  eval(code)
end

#to_okao(text = nil) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/okao/cli.rb', line 10

def to_okao(text = nil)
  init_emoticon
  normal_text = load_file(options[:file_path])
  normal_text ||= text

  okao_text = Okao::Parser.to_okao(normal_text)
  puts okao_text
end

#to_text(okao = nil) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/okao/cli.rb', line 21

def to_text(okao = nil)
  init_emoticon
  okao_text = load_file(options[:file_path])
  okao_text ||= okao

  normal_text = Okao::Parser.to_text(okao_text)
  puts normal_text
end