Class: OptionsParser

Inherits:
Object
  • Object
show all
Defined in:
lib/html2markdown/options_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ OptionsParser

Returns a new instance of OptionsParser.



6
7
8
9
10
11
12
13
14
# File 'lib/html2markdown/options_parser.rb', line 6

def initialize(options)
  @options = options

  if option?(:output_dir)
    @html2md = Html2MarkdownCli.new(options[:output_dir])
  else
    @html2md = Html2MarkdownCli.new
  end
end

Instance Attribute Details

#html2mdObject

Returns the value of attribute html2md.



4
5
6
# File 'lib/html2markdown/options_parser.rb', line 4

def html2md
  @html2md
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/html2markdown/options_parser.rb', line 4

def options
  @options
end

Instance Method Details

#parseObject



16
17
18
19
20
21
22
23
24
# File 'lib/html2markdown/options_parser.rb', line 16

def parse
  if option?(:file)
    parse_file
  elsif option?(:dir)
    parse_dir
  else
    puts "No options specified. See --help for options"
  end
end