class Lab42::Rgxargs::Syntax

Attributes

converter[R]
matcher[R]

Public Class Methods

new(matcher, converter) click to toggle source
# File lib/lab42/rgxargs/syntax.rb, line 14
def initialize matcher, converter
  @converter = converter
  @matcher   = matcher
end

Public Instance Methods

matches?(value) { |converter.(*captures)| ... } click to toggle source
# File lib/lab42/rgxargs/syntax.rb, line 5
def matches? value
  if match = matcher.match(value)
    yield converter.(*match.captures)
    true
  end
end