Class: VagrantPlugins::Skytap::API::Credentials
- Defined in:
- lib/vagrant-skytap/api/credentials.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#vm ⇒ Object
readonly
Returns the value of attribute vm.
Attributes inherited from Resource
Instance Method Summary collapse
-
#initialize(attrs, vm, env) ⇒ Credentials
constructor
A new instance of Credentials.
-
#recognized? ⇒ Boolean
Are the credentials in a form that we recognize?.
- #to_s ⇒ Object
Methods inherited from Resource
#refresh, #reload, resource_name, #url
Methods included from SpecifiedAttributes
Constructor Details
#initialize(attrs, vm, env) ⇒ Credentials
Returns a new instance of Credentials.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 13 def initialize(attrs, vm, env) super @vm = vm # Set username and password if we recognize them in the form # "uname / pw." uname, pw = text.split('/', 2).collect(&:strip) if uname && pw @username = uname @password = pw end end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
9 10 11 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 9 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
9 10 11 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 9 def username @username end |
#vm ⇒ Object (readonly)
Returns the value of attribute vm.
8 9 10 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 8 def vm @vm end |
Instance Method Details
#recognized? ⇒ Boolean
Are the credentials in a form that we recognize?
27 28 29 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 27 def recognized? !!(@username && @password) end |
#to_s ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 31 def to_s if recognized? "#{username} / #{password}" else text end end |