Sha256: f20dcb7905726b7001d1eb5c1e1c0411cd06d39a51297ab6c803e583e614fff2

Contents?: true

Size: 403 Bytes

Versions: 3

Compression:

Stored size: 403 Bytes

Contents

module DuckPuncher
  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

Array.send(:include, DuckPuncher::Array)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
duck_puncher-2.3.0 lib/duck_puncher/array.rb
duck_puncher-2.2.0 lib/duck_puncher/array.rb
duck_puncher-2.1.0 lib/duck_puncher/array.rb