def find_activities(limit, options = { })
      # default options
      options = {
        :skip     => 0,
        :before   => nil,
        :after    => nil,
        :entities => { },
        :only     => [ ],
        :except   => [ ],
      }.merge(options)

      options[:only] = [ options[:only] ] if (options[:only] && !options[:only].is_a?(Array))

      # find
      result = self.driver.find_activities(limit, options).map do |activity_hash|
        # run hook
        self.run_hook(:did_find_activity, activity_hash)

        # unserialize
        Activr::Activity.from_hash(activity_hash)
      end

      result
    end
def find_activities(limit, options = { })
      # default options
      options = {
        :skip     => 0,
        :before   => nil,
        :after    => nil,
        :entities => { },
        :only     => [ ],
        :except   => [ ],
      }.merge(options)

      options[:only] = [ options[:only] ] if (options[:only] && !options[:only].is_a?(Array))

      # find
      result = self.driver.find_activities(limit, options).map do |activity_hash|
        # run hook
        self.run_hook(:did_find_activity, activity_hash)

        # unserialize
        Activr::Activity.from_hash(activity_hash)
      end

      result
    end
Find latest activities

 @note If you use others selectors then 'limit' argument and 'skip' option then you have to setup corresponding indexes in database.

 @param limit [Integer] Max number of activities to find
 @param options [Hash] Options hash
 @option options [Integer]           :skip     Number of activities to skip (default: 0)
 @option options [Time]              :before   Find activities generated before that datetime (excluding)
 @option options [Time]              :after    Find activities generated after that datetime (excluding)
 @option options [Hash{Sym=>String}] :entities Filter by entities values (empty means 'all values')
 @option options [Array<Class>]      :only     Find only these activities
 @option options [Array<Class>]      :except   Skip these activities
 @return [Array<Activity>] An array of activities