class TextEditor::Configuration::Bootstrap

Public Instance Methods

configure(args) click to toggle source
   # File lib/text_editor/configuration/bootstrap.rb
 6 def configure(args)
 7   namespace.instance = editor
 8 
 9   options.order!(args)
10   options.parse!(args)
11 
12   config.files = args.map do |file|
13     Pathname.new(file)
14   end
15 
16   resolver.files.each do |file|
17     load file
18   end
19 end
options() click to toggle source
   # File lib/text_editor/configuration/bootstrap.rb
21 def options
22   @options ||= OptionParser.new do |opts|
23     opts.on("--log FILE", "-l") do |log|
24       config.log.file = log
25     end
26 
27     opts.on("--flavor FLAVOR", "-f") do |flavor|
28       config.default_flavor = flavor.to_sym
29     end
30 
31     opts.on("--version", "-v") do
32       puts editor.version
33       raise SystemExit
34     end
35   end
36 end

Private Instance Methods

namespace() click to toggle source
   # File lib/text_editor/configuration/bootstrap.rb
44 def namespace
45   Module.nesting.last
46 end
resolver() click to toggle source
   # File lib/text_editor/configuration/bootstrap.rb
40 def resolver
41   @resolver ||= Resolver.new(editor)
42 end