Class: Pry::Command::Ls::Grep

Inherits:
Object
  • Object
show all
Defined in:
lib/pry/commands/ls/grep.rb

Instance Method Summary collapse

Constructor Details

#initialize(grep_regexp) ⇒ Grep

Returns a new instance of Grep.



5
6
7
# File 'lib/pry/commands/ls/grep.rb', line 5

def initialize(grep_regexp)
  @grep_regexp = grep_regexp
end

Instance Method Details

#regexpObject



9
10
11
12
13
14
15
16
17
# File 'lib/pry/commands/ls/grep.rb', line 9

def regexp
  proc { |x|
    if x.instance_of?(Array)
      x.grep(@grep_regexp)
    else
      x =~ @grep_regexp
    end
  }
end