Class: Tinychef::Destination

Inherits:
Object
  • Object
show all
Defined in:
lib/tinychef/destination.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hostObject (readonly)

Returns the value of attribute host.



5
6
7
# File 'lib/tinychef/destination.rb', line 5

def host
  @host
end

#userObject (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_sObject



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