Class: Netzke::Core::EndpointResponse

Inherits:
Hash
  • Object
show all
Defined in:
lib/netzke/core/endpoint_response.rb

Overview

Represents the endpoint response at the server side. Collects instructions for the client-side object. Accessible as the ‘client` in the endpoint calls, e.g.:

class SimpleComponent < Netzke::Base
  endpoint :whats_up_server do
    client.set_title("Response from server")
  end
end

Instance Method Summary collapse

Methods inherited from Hash

#netzke_deep_map, #netzke_deep_replace, #netzke_jsonify, #netzke_literalize_keys, #netzke_update_keys

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *params) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/netzke/core/endpoint_response.rb', line 11

def method_missing(name, *params)
  if name.to_s =~ /(.+)=$/
    self[$1.to_sym] = params.first
  else
    self[name] = self.class.new if self[name].nil?
    self[name] = params if params.present?
    self[name]
  end
end