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-3.0.21 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.20 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.19 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.18 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.17 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.16 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.15 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.14 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.13 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.12 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.11 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.10 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.9 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.8 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.7 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.6 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.5 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.4 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.3 lib/eco/cli/config/filters/people_filters.rb
eco-helpers-3.0.2 lib/eco/cli/config/filters/people_filters.rb