class Bosh::Workspace::Credentials
Attributes
raw_credentials[R]
Public Class Methods
new(file)
click to toggle source
# File lib/bosh/workspace/credentials.rb, line 7 def initialize(file) @raw_credentials = YAML.load_file file end
Public Instance Methods
find_by_url(url)
click to toggle source
# File lib/bosh/workspace/credentials.rb, line 17 def find_by_url(url) credentials[url] end
perform_validation(options = {})
click to toggle source
# File lib/bosh/workspace/credentials.rb, line 11 def perform_validation(options = {}) Schemas::Credentials.new.validate raw_credentials rescue Membrane::SchemaValidationError => e errors << e.message end
url_protocols()
click to toggle source
# File lib/bosh/workspace/credentials.rb, line 21 def url_protocols Hash[raw_credentials.map { |c| [c['url'], git_protocol_from_url(c['url'])] }] end
Private Instance Methods
credentials()
click to toggle source
# File lib/bosh/workspace/credentials.rb, line 27 def credentials @credentials ||= begin Hash[raw_credentials.map { |c| c = c.dup; [c.delete('url'), symbolize_keys(c)] }] end end
symbolize_keys(hash)
click to toggle source
# File lib/bosh/workspace/credentials.rb, line 33 def symbolize_keys(hash) hash.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } end