Class: GitlabCli::Config
- Inherits:
-
Object
- Object
- GitlabCli::Config
- Defined in:
- lib/gitlab_cli/config.rb
Class Method Summary collapse
Class Method Details
.[](key) ⇒ Object
22 23 24 |
# File 'lib/gitlab_cli/config.rb', line 22 def [](key) @config[key] end |
.include?(key) ⇒ Boolean
18 19 20 |
# File 'lib/gitlab_cli/config.rb', line 18 def include?(key) @config.include?(key) end |
.load(source) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/gitlab_cli/config.rb', line 4 def load(source) @config = {:gitlab_url => nil,:private_token => nil,:display_results_in_pager => false} if source.is_a?(String) raise "Config file #{source} not found" unless File.exist?(source) config = YAML.load_file(source) @config.merge! config if config elsif source.is_a?(Hash) @config.merge! source end end |
.to_yaml ⇒ Object
26 27 28 |
# File 'lib/gitlab_cli/config.rb', line 26 def to_yaml @config.to_yaml end |