Sha256: 691991023329d04a9c0973fa8c4de8a175f83b9e577cd6b1aefbb86d865a3a17

Contents?: true

Size: 871 Bytes

Versions: 45

Compression:

Stored size: 871 Bytes

Contents

module Eco
  class CLI
    class Config
      class Filters
        class PeopleFilters < Eco::CLI::Config::Filters

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

          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
        end
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
eco-helpers-2.6.4 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.6.3 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.6.2 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.6.1 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.6.0 lib/eco/cli/config/filters/people_filters.rb