Class: Facter::Options
- Inherits:
-
Object
- Object
- Facter::Options
- Defined in:
- lib/facter/framework/core/options.rb
Class Method Summary collapse
- .[](key) ⇒ Object
- .[]=(key, value) ⇒ Object
- .cli? ⇒ Boolean
- .custom_dir ⇒ Object
- .custom_dir? ⇒ Boolean
- .external_dir ⇒ Object
- .external_dir? ⇒ Boolean
- .get ⇒ Object
- .init ⇒ Object
- .init_from_cli(cli_options = {}, user_query = nil) ⇒ Object
- .store(options) ⇒ Object
Class Method Details
.[](key) ⇒ Object
14 15 16 |
# File 'lib/facter/framework/core/options.rb', line 14 def [](key) OptionStore.send(key.to_sym) end |
.[]=(key, value) ⇒ Object
18 19 20 |
# File 'lib/facter/framework/core/options.rb', line 18 def []=(key, value) OptionStore.send("#{key}=".to_sym, value) end |
.cli? ⇒ Boolean
6 7 8 |
# File 'lib/facter/framework/core/options.rb', line 6 def cli? OptionStore.cli end |
.custom_dir ⇒ Object
26 27 28 |
# File 'lib/facter/framework/core/options.rb', line 26 def custom_dir [OptionStore.custom_dir].flatten end |
.custom_dir? ⇒ Boolean
22 23 24 |
# File 'lib/facter/framework/core/options.rb', line 22 def custom_dir? OptionStore.custom_dir && OptionStore.custom_facts end |
.external_dir ⇒ Object
34 35 36 |
# File 'lib/facter/framework/core/options.rb', line 34 def external_dir OptionStore.external_dir end |
.external_dir? ⇒ Boolean
30 31 32 |
# File 'lib/facter/framework/core/options.rb', line 30 def external_dir? OptionStore.external_dir && OptionStore.external_facts end |
.get ⇒ Object
10 11 12 |
# File 'lib/facter/framework/core/options.rb', line 10 def get OptionStore.all end |
.init ⇒ Object
38 39 40 41 42 |
# File 'lib/facter/framework/core/options.rb', line 38 def init OptionStore.cli = false ConfigFileOptions.init store(ConfigFileOptions.get) end |
.init_from_cli(cli_options = {}, user_query = nil) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/facter/framework/core/options.rb', line 44 def init_from_cli( = {}, user_query = nil) Facter::OptionStore.cli = true Facter::OptionStore.show_legacy = false Facter::OptionStore.user_query = user_query Facter::OptionStore.trace = [:trace] OptionStore.set(:config, [:config]) ConfigFileOptions.init([:config]) store(ConfigFileOptions.get) store() Facter::OptionsValidator.validate_configs(get) end |
.store(options) ⇒ Object
57 58 59 60 61 62 |
# File 'lib/facter/framework/core/options.rb', line 57 def store() .each do |key, value| value = '' if key == 'log_level' && value == 'log_level' OptionStore.set(key, value) end end |