Sha256: 5f7bd4fac830e42b57e01c880582d5015fb2dc962a2e852964e359d39e50905f
Contents?: true
Size: 710 Bytes
Versions: 2
Compression:
Stored size: 710 Bytes
Contents
$:.unshift File.dirname(__FILE__) require 'rack_interface/route' 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.params.first.call(response.params.inject({}){|h,(k,v)| h[k]=v.to_s; h }) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
joshbuddy-usher-0.4.2 | lib/usher/interface/email_interface.rb |
joshbuddy-usher-0.4.3 | lib/usher/interface/email_interface.rb |