Module: Zeng::Document

Defined in:
lib/zeng/document.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.add_client(client) ⇒ Object



311
312
313
# File 'lib/zeng/document.rb', line 311

def add_client(client)
  (@clients ||= []) << client if client.is_a? Class
end

.backend_configure(klass, adapter, host_port) ⇒ Object



302
303
# File 'lib/zeng/document.rb', line 302

def backend_configure(klass,adapter, host_port )
end

.clientsObject



315
316
317
# File 'lib/zeng/document.rb', line 315

def clients
  (@clients ||= []).dup
end

.docking(mod) ⇒ Object

docking external mod, so that expanding Document’s functions and class who has included Document will hold the exteranl mod’s methods.



307
308
309
# File 'lib/zeng/document.rb', line 307

def docking(mod)
  @clients.each {|client| client.send :include, mod }
end

.included(base) ⇒ Object



64
65
66
67
68
69
# File 'lib/zeng/document.rb', line 64

def self.included(base)
  base.extend ClassMethods
  base.select_serializer(:json)
  base.send :include, InstanceMethods
  add_client(base) unless clients.include?(base)
end