Sha256: 52b80bf884e8041a5a6235d39d2b1bb356f9db4f223f6c446b5b604d67badf24
Contents?: true
Size: 720 Bytes
Versions: 1
Compression:
Stored size: 720 Bytes
Contents
module Mountapi module Route # The handler is called if the route match # Handler data should be any string representation of callable class Handler def initialize(callable) self.callable = callable end def callable=(callable) @callable ||= if callable.respond_to? :call callable elsif callable.kind_of?(String) eval(callable) else raise ArgumentError, "invalid callable: #{callable}" end end def raw_value @callable end def call(*params) @callable.call(*params) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mountapi-0.11.1 | lib/mountapi/route/handler.rb |