Class: Campfiyah::Adapters::Memory

Inherits:
Adapter
  • Object
show all
Defined in:
lib/campfiyah/adapters/memory.rb

Instance Attribute Summary

Attributes inherited from Adapter

#subdomain, #token

Instance Method Summary collapse

Methods inherited from Adapter

#initialize

Constructor Details

This class inherits a constructor from Campfiyah::Adapters::Adapter

Instance Method Details

#message(room_id, message) ⇒ Object



14
15
16
# File 'lib/campfiyah/adapters/memory.rb', line 14

def message(room_id, message)
  true
end

#roomsObject



4
5
6
# File 'lib/campfiyah/adapters/memory.rb', line 4

def rooms
  @rooms ||= Yajl.load(File.read("#{File.dirname(__FILE__)}/memory/rooms.json"))['rooms']
end

#user_by_id(id) ⇒ Object



8
9
10
11
12
# File 'lib/campfiyah/adapters/memory.rb', line 8

def user_by_id(id)
  hash = Yajl.load(File.read("#{File.dirname(__FILE__)}/memory/user.json"))['user']
  hash['id'] = id
  hash
end