Sha256: 5230da0da44e3a2274d568f4920b5f996fb0edcb6d125c079c796761db30a2f5
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module ExtDirect module Service class Provider @@store = {} class << self def register(type, action, method, proc) action = action.to_sym method = method.to_sym @@store[action] = {} unless @@store[action] @@store[action][method] = {} unless @@store[action][method] @@store[action][method][:type] = type @@store[action][method][:proc] = proc end def fetch @@store end def exist?(action, method) (@@store[action.to_sym] and @@store[action.to_sym][method.to_sym]) end def type_of(action, method) false unless exist?(action, method) @@store[action.to_sym][method.to_sym][:type] end def execute(action, method, params = nil) raise "Unknown action or method" unless exist?(action, method) @@store[action.to_sym][method.to_sym][:proc].call(params) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ext_direct-0.2.0 | lib/ext_direct/service/provider.rb |