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.



7
8
9
# File 'lib/pry/commands/ls/grep.rb', line 7

def initialize(grep_regexp)
  @grep_regexp = grep_regexp
end

Instance Method Details

#regexpObject



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

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