Class: Twitorious::Notifier
- Inherits:
-
Object
- Object
- Twitorious::Notifier
- Defined in:
- lib/twitorious/notifier.rb
Instance Method Summary collapse
-
#initialize ⇒ Notifier
constructor
A new instance of Notifier.
- #notify(sender, message, created, icon = nil) ⇒ Object
Constructor Details
#initialize ⇒ Notifier
Returns a new instance of Notifier.
7 8 9 |
# File 'lib/twitorious/notifier.rb', line 7 def initialize @meow = Meow.new("Twitorious") end |
Instance Method Details
#notify(sender, message, created, icon = nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/twitorious/notifier.rb', line 11 def notify(sender, , created, icon = nil) created = DateTime.parse(created) now = DateTime.parse(Time.now.to_s).new_offset(created.offset) time_ago = Twitorious.time_ago_in_words(created, now, true) opts = {} opts[:icon] = icon if icon @meow.notify("#{sender} (#{time_ago})", , opts) do urls = URI.extract(, ['http', 'https']) urls.each do |url| %x{open #{url}} end end end |