Module: SendTokindle
- Defined in:
- lib/send_to_kindle.rb
Class Method Summary collapse
Class Method Details
.default_options ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/send_to_kindle.rb', line 7 def self. { paths: nil, file_types: '\.pdf$', notifications: { mediums: { kindle: true, osx_notification_center: true, terminal: false }, sender: { address: nil, port: nil, domain: nil, user_name: nil, password: nil, authentication: nil, enable_starttls_auto: false }, from: nil, kindle: nil } } end |
.listen(options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/send_to_kindle.rb', line 32 def self.listen(={}) = .merge() callback = Proc.new do |modified_paths, added_paths, removed_paths| modified_paths.each { |path| SendToKindle::Notifications::Modification.new(path, [:notifications]).send } added_paths.each { |path| SendToKindle::Notifications::Creation.new(path, [:notifications]).send } end Listen.to([:paths]) .filter(Regexp.new([:file_types])) .latency(0.5) .force_polling(true) .change(&callback) .start end |