names

mtch.names รข [name1, name2, ...]
Instance Public methods

Returns a list of names of captures as an array of strings. It is same as mtch.regexp.names.

/(?<foo>.)(?<bar>.)(?<baz>.)/.match("hoge").names
#=> ["foo", "bar", "baz"]

m = /(?<x>.)(?<y>.)?/.match("a") #=> #<MatchData "a" x:"a" y:nil>
m.names                          #=> ["x", "y"]
doc_ruby_on_rails
2015-04-17 23:51:59
Comments
Leave a Comment

Please login to continue.