Class: Tinychef::Destination
- Inherits:
-
Object
- Object
- Tinychef::Destination
- Defined in:
- lib/tinychef/destination.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(dest) ⇒ Destination
constructor
A new instance of Destination.
- #to_s ⇒ Object
Constructor Details
#initialize(dest) ⇒ Destination
Returns a new instance of Destination.
7 8 9 10 11 12 13 |
# File 'lib/tinychef/destination.rb', line 7 def initialize(dest) if dest.include? '@' @user, @host = dest.split('@') else @user = nil ; @host = dest end end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/tinychef/destination.rb', line 5 def host @host end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'lib/tinychef/destination.rb', line 5 def user @user end |
Instance Method Details
#to_s ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/tinychef/destination.rb', line 15 def to_s if user.nil? host else "#{user}@#{host}" end end |