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



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

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



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

def process(io:)
  unless io && 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|
    if SCR.get_arg(arg)
      io = io.new(people: callback.call(*io.params))
    end
  end
  io.people
end