Class: NewsmastMastodon::CustomFeed

Inherits:
Object
  • Object
show all
Includes:
Redisable
Defined in:
app/models/newsmast_mastodon/custom_feed.rb

Instance Method Summary collapse

Constructor Details

#initialize(account, options = {}) ⇒ CustomFeed

Returns a new instance of CustomFeed.

Parameters:

  • account (Account)
  • options (Hash) (defaults to: {})
  • [Boolean] (Hash)

    a customizable set of options



14
15
16
17
# File 'app/models/newsmast_mastodon/custom_feed.rb', line 14

def initialize(, options = {})
  @account = 
  @options = options
end

Instance Method Details

#get(limit, max_id = nil, since_id = nil, min_id = nil) ⇒ Array<Status>

Parameters:

  • limit (Integer)
  • max_id (Integer) (defaults to: nil)
  • since_id (Integer) (defaults to: nil)
  • min_id (Integer) (defaults to: nil)

Returns:

  • (Array<Status>)


24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/newsmast_mastodon/custom_feed.rb', line 24

def get(limit, max_id = nil, since_id = nil, min_id = nil)
  scope = custom_scope

  scope.merge!(without_replies_scope) unless with_replies?
  scope.merge!(without_reblogs_scope) unless with_reblogs?
  scope.merge!(local_only_scope) if local_only?
  scope.merge!(remote_only_scope) if remote_only?
  scope.merge!() if account?
  scope.merge!(media_only_scope) if media_only?
  scope.merge!(language_scope) if &.chosen_languages.present?

  scope.to_a_paginated_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
end