Class: Papertrail::SearchResult

Inherits:
Object
  • Object
show all
Defined in:
lib/papertrail/search_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ SearchResult

Returns a new instance of SearchResult.



7
8
9
10
11
12
13
# File 'lib/papertrail/search_result.rb', line 7

def initialize(data)
  @data = data

  @events = @data['events'].collect do |event|
    Papertrail::Event.new(event)
  end
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/papertrail/search_result.rb', line 5

def data
  @data
end

#eventsObject (readonly)

Returns the value of attribute events.



5
6
7
# File 'lib/papertrail/search_result.rb', line 5

def events
  @events
end

Instance Method Details

#max_idObject



23
24
25
# File 'lib/papertrail/search_result.rb', line 23

def max_id
  @data['max_id']
end

#max_time_atObject



19
20
21
# File 'lib/papertrail/search_result.rb', line 19

def max_time_at
  @max_time_at ||= Time.parse(@data['max_time_at'])
end

#min_idObject



27
28
29
# File 'lib/papertrail/search_result.rb', line 27

def min_id
  @data['min_id']
end

#reached_end?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/papertrail/search_result.rb', line 15

def reached_end?
  @data['reached_end']
end