Module: Agrep

Included in:
ActiveConsole, Hash
Defined in:
lib/active_console/agrep.rb

Instance Method Summary collapse

Instance Method Details

#agrep(pattern) ⇒ Object



2
3
4
5
6
# File 'lib/active_console/agrep.rb', line 2

def agrep(pattern)
  regex = Regexp.new pattern
  agrep = self.dup.select { |k, v| k.to_s =~ regex || v.to_s =~ regex }
  agrep.present? ? agrep : self
end