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

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/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/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/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/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/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