lib/boson/inspectors/argument_inspector.rb in boson-0.2.1 vs lib/boson/inspectors/argument_inspector.rb in boson-0.2.2
- old
+ new
@@ -4,11 +4,11 @@
module Boson::ArgumentInspector
extend self
# Returns same argument arrays as scrape_with_eval but argument defaults haven't been evaluated.
def scrape_with_text(file_string, meth)
tabspace = "[ \t]"
- if match = /^#{tabspace}*def#{tabspace}+#{meth}\b#{tabspace}*($|\(?\s*([^\)]+)\s*\)?\s*$)/.match(file_string)
- (match.to_a[2] || '').split(/\s*,\s*/).map {|e| e.split(/\s*=\s*/)}
+ if match = /^#{tabspace}*def#{tabspace}+(?:\w+\.)?#{Regexp.quote(meth)}#{tabspace}*($|(?:\(|\s+)([^\n\)]+)\s*\)?\s*$)/.match(file_string)
+ (match.to_a[2] || '').strip.split(/\s*,\s*/).map {|e| e.split(/\s*=\s*/)}
end
end
# Max number of arguments extracted per method with scrape_with_eval
MAX_ARGS = 10
\ No newline at end of file