Class: Abak::Flow::Configuration
- Inherits:
-
Object
- Object
- Abak::Flow::Configuration
- Defined in:
- lib/abak-flow/configuration.rb
Constant Summary collapse
- AVAILABLE_OPTIONS =
TODO: Add old oauth_login and oauth_token
%w{login password locale http_proxy}.map(&:freeze)
- GITCONFIG_PATTERN =
/abak\-flow\.([\w\d\-\_]+)/.freeze
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(options = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #rewrite(options) ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(options = nil) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/abak-flow/configuration.rb', line 9 def initialize( = nil) @_errors = Hash.new @options = { login: nil, password: nil, locale: "en", http_proxy: ENV["http_proxy"] || ENV["HTTP_PROXY"] } .nil? ? : () create_public_instance_methods end |
Instance Method Details
#errors ⇒ Object
37 38 39 |
# File 'lib/abak-flow/configuration.rb', line 37 def errors ErrorsPresenter.new(self, @_errors) end |
#rewrite(options) ⇒ Object
24 25 26 27 |
# File 'lib/abak-flow/configuration.rb', line 24 def rewrite() () write_to_gitconfig! end |
#valid? ⇒ Boolean
29 30 31 32 33 34 35 |
# File 'lib/abak-flow/configuration.rb', line 29 def valid? @_errors = Hash.new @_errors["login"] = ['blank'] if @options[:login].to_s.empty? @_errors["password"] = ['blank'] if @options[:password].to_s.empty? @_errors.empty? end |