Sha256: dd2b5fa3fa585ed1a361cab26a9e10a286c63da4a21f72761c7020deada2acbd

Contents?: true

Size: 407 Bytes

Versions: 15

Compression:

Stored size: 407 Bytes

Contents

module DuckPuncher
  module Ducks
    module Array
      def m(method_name)
        map(&method_name)
      end

      def mm(method_name, *args)
        map { |x| x.public_send(method_name, *args) }
      end

      def get(regex_or_str)
        regex = regex_or_str.is_a?(Regexp) ? regex_or_str : Regexp.new(Regexp.escape(regex_or_str))
        select { |x| x.to_s =~ regex }
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
duck_puncher-2.12.1 lib/duck_puncher/ducks/array.rb
duck_puncher-2.12.0 lib/duck_puncher/ducks/array.rb
duck_puncher-2.11.0 lib/duck_puncher/ducks/array.rb
duck_puncher-2.10.2 lib/duck_puncher/ducks/array.rb
duck_puncher-2.10.1 lib/duck_puncher/ducks/array.rb
duck_puncher-2.10.0 lib/duck_puncher/ducks/array.rb
duck_puncher-2.9.3 lib/duck_puncher/ducks/array.rb
duck_puncher-2.9.2 lib/duck_puncher/ducks/array.rb
duck_puncher-2.9.1 lib/duck_puncher/ducks/array.rb
duck_puncher-2.9.0 lib/duck_puncher/ducks/array.rb
duck_puncher-2.8.0 lib/duck_puncher/ducks/array.rb
duck_puncher-2.7.0 lib/duck_puncher/ducks/array.rb
duck_puncher-2.6.0 lib/duck_puncher/ducks/array.rb
duck_puncher-2.5.1 lib/duck_puncher/ducks/array.rb
duck_puncher-2.5.0 lib/duck_puncher/ducks/array.rb