Class: Kaimono::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/kaimono/command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Command

Returns a new instance of Command.



9
10
11
12
13
# File 'lib/kaimono/command.rb', line 9

def initialize(argv)
  @argv = argv
  @kaimono_list = Kaimono::Options.new
  @options = @kaimono_list.parse(@argv)
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



3
4
5
# File 'lib/kaimono/command.rb', line 3

def opts
  @opts
end

Class Method Details

.run(argv) ⇒ Object



5
6
7
# File 'lib/kaimono/command.rb', line 5

def self.run(argv)
  new(argv).execute
end

Instance Method Details

#executeObject



23
24
25
26
# File 'lib/kaimono/command.rb', line 23

def execute
  puts @kaimono_list.to_s
  output_html
end

#output_htmlObject



15
16
17
18
19
20
21
# File 'lib/kaimono/command.rb', line 15

def output_html
  html_file = @kaimono_list.filename + ".html"
  File.open(html_file, "w") do |w|
     w.puts @kaimono_list.to_html
  end
  puts "output HTML => #{html_file}"  
end