class Captio::Handler

Public Class Methods

new(regexp, action) click to toggle source
# File lib/captio/line_handler.rb, line 3
def initialize(regexp, action)
  @regexp = regexp
  @action = action || lambda { |x| x }
end

Public Instance Methods

handle(str) click to toggle source
# File lib/captio/line_handler.rb, line 8
def handle(str)
  @action.call(str) if @regexp =~ str
end