Class: Cline::Collectors::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cline/collectors.rb

Direct Known Subclasses

Feed, Github

Class Method Summary collapse

Class Method Details

.create_or_pass(message, notified_at) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cline/collectors.rb', line 6

def create_or_pass(message, notified_at)
  message     = message.encode(Encoding::UTF_8)
  notified_at = parse_time_string_if_needed(notified_at)

  return if oldest_notification.notified_at.to_time > notified_at

  Cline::Notification.instance_exec message, notified_at do |message, notified_at|
    create(message: message, notified_at: notified_at) unless find_by_message_and_notified_at(message, notified_at)
  end
rescue ActiveRecord::StatementInvalid => e
  puts e.class, e.message
end