class WebsocketRails::DataStore::Base
Public Class Methods
clear_all_instances()
click to toggle source
# File lib/websocket_rails/data_store.rb, line 25 def self.clear_all_instances @@all_instances = Hash.new { |h,k| h[k] = [] } end
new()
click to toggle source
# File lib/websocket_rails/data_store.rb, line 29 def initialize instances << self end
Public Instance Methods
collect_all(key) { |item| ... }
click to toggle source
# File lib/websocket_rails/data_store.rb, line 37 def collect_all(key) collection = instances.each_with_object([]) do |instance, array| array << instance[key] end if block_given? collection.each do |item| yield(item) end else collection end end
destroy!()
click to toggle source
# File lib/websocket_rails/data_store.rb, line 51 def destroy! instances.delete_if {|store| store.object_id == self.object_id } end
instances()
click to toggle source
# File lib/websocket_rails/data_store.rb, line 33 def instances all_instances[self.class] end