Class: SourceFinder::OptionParser
- Inherits:
-
Object
- Object
- SourceFinder::OptionParser
- Defined in:
- lib/source_finder/option_parser.rb
Overview
Brings in command-line options to configure SourceFinder–usable with the ruby OptionParser class, brought in with ‘require “optparse”’
Instance Method Summary collapse
- #add_exclude_glob_option(opts, options) ⇒ Object
- #add_glob_option(opts, options) ⇒ Object
- #add_options(opts, options) ⇒ Object
- #default_source_files_exclude_glob ⇒ Object
- #default_source_files_glob ⇒ Object
- #fresh_globber ⇒ Object
Instance Method Details
#add_exclude_glob_option(opts, options) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/source_finder/option_parser.rb', line 28 def add_exclude_glob_option(opts, ) opts.on('-e glob here', '--exclude-glob', 'Files to exclude - default is none') do |v| [:exclude] = v end end |
#add_glob_option(opts, options) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/source_finder/option_parser.rb', line 20 def add_glob_option(opts, ) opts.on('-g glob here', '--glob', 'Which files to parse - ' \ "default is #{default_source_files_glob}") do |v| [:glob] = v end end |
#add_options(opts, options) ⇒ Object
35 36 37 38 |
# File 'lib/source_finder/option_parser.rb', line 35 def (opts, ) add_glob_option(opts, ) add_exclude_glob_option(opts, ) end |
#default_source_files_exclude_glob ⇒ Object
16 17 18 |
# File 'lib/source_finder/option_parser.rb', line 16 def default_source_files_exclude_glob fresh_globber.source_files_exclude_glob end |
#default_source_files_glob ⇒ Object
12 13 14 |
# File 'lib/source_finder/option_parser.rb', line 12 def default_source_files_glob fresh_globber.source_files_glob end |
#fresh_globber ⇒ Object
8 9 10 |
# File 'lib/source_finder/option_parser.rb', line 8 def fresh_globber SourceFinder::SourceFileGlobber.new end |