Sha256: b9fcd1c57069c22c00d4c58b591e7381d2127ad8e0ba20e7b534df191a08cf1b

Contents?: true

Size: 873 Bytes

Versions: 80

Compression:

Stored size: 873 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

80 entries across 80 versions & 1 rubygems

Version Path
eco-helpers-2.2.5 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.2.4 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.2.3 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.2.2 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.2.1 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.12 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.11 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.10 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.9 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.8 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.7 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.6 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.5 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.4 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.3 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.2 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.1.1 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.0.68 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.0.67 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-2.0.66 lib/eco/cli/config/filters/people_filters.rb