Class: Nwcopy::Dropbox
- Inherits:
-
Object
- Object
- Nwcopy::Dropbox
- Defined in:
- lib/nwcopy/dropbox.rb
Class Attribute Summary collapse
-
.dropbox_base ⇒ Object
Returns the value of attribute dropbox_base.
Class Method Summary collapse
- .available? ⇒ Boolean
- .copy(io) ⇒ Object
- .paste(ignored = nil) ⇒ Object
-
.time ⇒ Object
Used to determine which plugin has the newest file.
- .unavailable_message ⇒ Object
Class Attribute Details
.dropbox_base ⇒ Object
Returns the value of attribute dropbox_base.
6 7 8 |
# File 'lib/nwcopy/dropbox.rb', line 6 def dropbox_base @dropbox_base end |
Class Method Details
.available? ⇒ Boolean
13 14 15 16 17 18 19 20 21 |
# File 'lib/nwcopy/dropbox.rb', line 13 def self.available? return false unless File.exists? dropbox_dir unless File.exists? nwcopy_dir Dir.mkdir nwcopy_dir end File.exists? nwcopy_dir end |
.copy(io) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/nwcopy/dropbox.rb', line 23 def self.copy io clipboard = io.read digest = Digest::SHA1.hexdigest clipboard nwcopy_file = File.join nwcopy_dir, digest File.open(nwcopy_file, 'w+') do |f| f << clipboard end nwcopy_file end |
.paste(ignored = nil) ⇒ Object
38 39 40 |
# File 'lib/nwcopy/dropbox.rb', line 38 def self.paste ignored = nil latest_file.read end |
.time ⇒ Object
Used to determine which plugin has the newest file.
34 35 36 |
# File 'lib/nwcopy/dropbox.rb', line 34 def self.time latest_file ? latest_file.mtime : nil end |
.unavailable_message ⇒ Object
9 10 11 |
# File 'lib/nwcopy/dropbox.rb', line 9 def self. "Dropbox was not found at #{nwcopy_dir}. Get it at http://getdropbox.com/" end |