Class: NewsFetcher::Commands::Show

Inherits:
NewsFetcher::Command show all
Defined in:
lib/newsfetcher/commands/show.rb

Instance Attribute Summary collapse

Attributes inherited from NewsFetcher::Command

#dir, #log_level, #max_threads

Instance Method Summary collapse

Instance Attribute Details

#sortObject

Returns the value of attribute sort.



8
9
10
# File 'lib/newsfetcher/commands/show.rb', line 8

def sort
  @sort
end

#statusObject

Returns the value of attribute status.



7
8
9
# File 'lib/newsfetcher/commands/show.rb', line 7

def status
  @status
end

Instance Method Details

#run(args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/newsfetcher/commands/show.rb', line 10

def run(args)
  super
  @profile.find_subscriptions(
    ids: args,
    status: @status&.split(',')&.map(&:to_sym),
    sort: @sort&.to_sym,
  ).each do |subscription|
    subscription.print
    puts
  end
end