Method: Pry::Hackage::Hack#score

Defined in:
lib/pry/hack.rb

#score(text) ⇒ Fixnum

Lexical score of a string in relation to the regular expression of the hack.



92
93
94
95
96
97
98
99
100
# File 'lib/pry/hack.rb', line 92

def score(text)
  md = @PATTERN.match(text)
  return if md.nil?
  cap = md.captures
  define_singleton_method(:capture) do |x|
    cap[x-1]
  end
  return cap.join.length
end