Class: ASS::CallbackFactory
- Inherits:
-
Object
- Object
- ASS::CallbackFactory
- Defined in:
- lib/ass/callback_factory.rb
Defined Under Namespace
Modules: ServiceMethods
Instance Method Summary collapse
- #callback_for(server, header, payload) ⇒ Object
-
#initialize(callback) ⇒ CallbackFactory
constructor
A new instance of CallbackFactory.
Constructor Details
#initialize(callback) ⇒ CallbackFactory
Returns a new instance of CallbackFactory.
45 46 47 |
# File 'lib/ass/callback_factory.rb', line 45 def initialize(callback) @factory = build_factory(callback) end |
Instance Method Details
#callback_for(server, header, payload) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ass/callback_factory.rb', line 49 def callback_for(server,header,payload) # method,data if @factory.is_a? Class if @factory.respond_to? :version klass = @factory.get_version(payload[:version]) else klass = @factory end obj = klass.new else obj = @factory end obj.instance_variable_set("@__service__",server) obj.instance_variable_set("@__header__",header) obj.instance_variable_set("@__payload__",payload) obj.instance_variable_set("@__method__",payload[:method]) obj.instance_variable_set("@__data__",payload[:data]) obj.instance_variable_set("@__meta__",payload[:meta]) obj.instance_variable_set("@__version__",payload[:version]) obj end |