Class: ActionTracker::RecordsCollection
- Inherits:
-
Array
- Object
- Array
- ActionTracker::RecordsCollection
- Defined in:
- lib/action_tracker/utils/records_collection.rb
Instance Method Summary collapse
Instance Method Details
#last_content ⇒ Object
19 20 21 |
# File 'lib/action_tracker/utils/records_collection.rb', line 19 def last_content last.dig(:payload, :content) end |
#last_event ⇒ Object
15 16 17 |
# File 'lib/action_tracker/utils/records_collection.rb', line 15 def last_event last.dig(:payload, :event) end |
#select_by(path, value) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/action_tracker/utils/records_collection.rb', line 5 def select_by(path, value) keys = path.to_s.split('.').map(&:to_sym) items = select do |item| item.dig(*keys) == value end self.class.new items end |