Class: Eco::CLI::Config::Filters::PeopleFilters

Inherits:
Eco::CLI::Config::Filters show all
Defined in:
lib/eco/cli/config/filters/people_filters.rb

Instance Attribute Summary

Attributes inherited from Eco::CLI::Config::Filters

#core_config

Instance Method Summary collapse

Methods inherited from Eco::CLI::Config::Filters

#add, #available, #initialize

Constructor Details

This class inherits a constructor from Eco::CLI::Config::Filters

Instance Method Details

#help(refine: nil) ⇒ Object



6
7
8
9
# File 'lib/eco/cli/config/filters/people_filters.rb', line 6

def help(refine: nil)
  refinement = refine.is_a?(String)? " (containing: '#{refine}')" : ""
  super("The following are the available filters on people#{refinement}:", refine: refine)
end

#process(io:) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/eco/cli/config/filters/people_filters.rb', line 11

def process(io:)
  unless io.is_a?(Eco::API::UseCases::BaseIO)
    raise "You need to provide Eco::API::UseCases::BaseIO object. Given: #{io.class}"
  end

  io = io.new(type: :transform)

  @filters.each do |arg, callback|
    next unless SCR.get_arg(arg)

    io = io.new(data: callback.call(*io.params))
  end

  io.people
end