Class: ODisk::Remote
- Inherits:
-
Object
- Object
- ODisk::Remote
- Defined in:
- lib/odisk/remote.rb
Overview
Just a way to keep the data associated with a remote site together one Object.
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#host ⇒ Object
Returns the value of attribute host.
-
#pass_file ⇒ Object
Returns the value of attribute pass_file.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #complete? ⇒ Boolean
- #encrypt? ⇒ Boolean
-
#initialize ⇒ Remote
constructor
A new instance of Remote.
- #okay? ⇒ Boolean
- #to_s ⇒ Object
-
#update(str) ⇒ Object
Expects a string as input of the form [email protected]:dir:passphrase_file.
Constructor Details
#initialize ⇒ Remote
Returns a new instance of Remote.
11 12 13 14 15 16 |
# File 'lib/odisk/remote.rb', line 11 def initialize() @user = nil @host = nil @dir = nil @pass_file = nil end |
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
8 9 10 |
# File 'lib/odisk/remote.rb', line 8 def dir @dir end |
#host ⇒ Object
Returns the value of attribute host.
7 8 9 |
# File 'lib/odisk/remote.rb', line 7 def host @host end |
#pass_file ⇒ Object
Returns the value of attribute pass_file.
9 10 11 |
# File 'lib/odisk/remote.rb', line 9 def pass_file @pass_file end |
#user ⇒ Object
Returns the value of attribute user.
6 7 8 |
# File 'lib/odisk/remote.rb', line 6 def user @user end |
Instance Method Details
#complete? ⇒ Boolean
28 29 30 |
# File 'lib/odisk/remote.rb', line 28 def complete?() !(@user.nil? || @host.nil? || @dir.nil? || @pass_file.nil?) end |
#encrypt? ⇒ Boolean
36 37 38 |
# File 'lib/odisk/remote.rb', line 36 def encrypt?() !@pass_file.nil? end |
#okay? ⇒ Boolean
32 33 34 |
# File 'lib/odisk/remote.rb', line 32 def okay?() !(@user.nil? || @host.nil? || @dir.nil?) end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/odisk/remote.rb', line 40 def to_s() "#{user}@#{host}:#{@dir}:#{@pass_file}" end |
#update(str) ⇒ Object
Expects a string as input of the form [email protected]:dir:passphrase_file
19 20 21 22 23 24 25 26 |
# File 'lib/odisk/remote.rb', line 19 def update(str) u, x = str.strip().split('@') h, t, p = x.split(':') @user = u if @user.nil? && u.is_a?(String) && !u.empty? @host = h if @host.nil? && h.is_a?(String) && !h.empty? @dir = t if @dir.nil? && t.is_a?(String) && !t.empty? @pass_file = p if @pass_file.nil? && p.is_a?(String) && !p.empty? end |