Class: Furik::Events
- Inherits:
-
Object
- Object
- Furik::Events
- Defined in:
- lib/furik/events.rb
Instance Method Summary collapse
- #aggressives ⇒ Object
- #events_with_grouping(from, to, &block) ⇒ Object
-
#initialize(client) ⇒ Events
constructor
A new instance of Events.
Constructor Details
#initialize(client) ⇒ Events
Returns a new instance of Events.
3 4 5 6 |
# File 'lib/furik/events.rb', line 3 def initialize(client) @client = client @login = client.login end |
Instance Method Details
#aggressives ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/furik/events.rb', line 21 def aggressives %w( IssuesEvent PullRequestEvent PullRequestReviewCommentEvent IssueCommentEvent CommitCommentEvent ) end |
#events_with_grouping(from, to, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/furik/events.rb', line 8 def events_with_grouping(from, to, &block) @client.user_events(@login).each.with_object({}) { |event, memo| if event && aggressives.include?(event.type) if from <= event.created_at.localtime.to_date && event.created_at.localtime.to_date <= to memo[event.repo.name] ||= [] memo[event.repo.name] << event end end }.each do |repo, events| block.call(repo, events) if block end end |