public
Description: Pure Ruby implementation of an SFTP (protocols 1-6) client
Homepage: http://rubyforge.org/projects/net-ssh
Clone URL: git://github.com/jamis/net-sftp.git
custom properties on the download operations
jamis (author)
Thu Apr 24 20:38:01 -0700 2008
commit  072a5e9de0835605a0c8d6e4b561254bb9efaabe
tree    df9015e393391316f61d1b077cf1b97c2ba12a96
parent  f2b76f20460cff435f8726ec2883b9fac668cbff
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 === *unreleased*
0
 
0
+* Custom properties on Download instances [Jamis Buck]
0
+
0
 * Add #abort! method to Upload and Download operations [Jamis Buck]
0
 
0
 * More complete support for file-type detection in protocol versions 1-3 [Jamis Buck]
...
132
133
134
 
 
 
135
136
137
...
147
148
149
 
150
151
152
...
183
184
185
 
 
 
 
 
 
 
 
 
 
 
 
186
187
188
...
132
133
134
135
136
137
138
139
140
...
150
151
152
153
154
155
156
...
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
0
@@ -132,6 +132,9 @@ module Net; module SFTP; module Operations
0
     # The SFTP session instance that drives this download.
0
     attr_reader :sftp
0
 
0
+ # The properties hash for this object
0
+ attr_reader :properties
0
+
0
     # Instantiates a new downloader process on top of the given SFTP session.
0
     # +local+ is either an IO object that should receive the data, or a string
0
     # identifying the target file or directory on the local host. +remote+ is
0
@@ -147,6 +150,7 @@ module Net; module SFTP; module Operations
0
       @progress = progress || options[:progress]
0
       @options = options
0
       @active = 0
0
+ @properties = {}
0
 
0
       self.logger = sftp.logger
0
 
0
@@ -183,6 +187,18 @@ module Net; module SFTP; module Operations
0
       self
0
     end
0
 
0
+ # Returns the property with the given name. This allows Download instances
0
+ # to store their own state when used as part of a state machine.
0
+ def [](name)
0
+ @properties[name.to_sym]
0
+ end
0
+
0
+ # Sets the given property to the given name. This allows Download instances
0
+ # to store their own state when used as part of a state machine.
0
+ def []=(name, value)
0
+ @properties[name.to_sym] = value
0
+ end
0
+
0
     private
0
 
0
       # A simple struct for encapsulating information about a single remote

Comments

    No one has commented yet.