Sha256: c0b4fb00d104604d8b71314a76292aafbc8790de3589e00d6536367f0d0966ed
Contents?: true
Size: 642 Bytes
Versions: 4
Compression:
Stored size: 642 Bytes
Contents
class Usher module Interface class EmailInterface def initialize(&blk) @routes = Usher.new(:delimiters => ['@', '-', '.'], :valid_regex => '[\+a-zA-Z0-9]+', :globs_capture_separators => true) instance_eval(&blk) if blk end def for(path, &block) @routes.add_route(path).to(block) end def reset! @routes.reset! end def act(email) response = @routes.recognize(email, email) if response.path response.path.route.destination.call(response.params.inject({}){|h,(k,v)| h[k]=v.to_s; h }) end end end end end
Version data entries
4 entries across 4 versions & 2 rubygems