Class: Cachai::Admin
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Cachai::Admin
- Defined in:
- lib/cachai.rb
Instance Method Summary collapse
- #deliver(obj, view) ⇒ Object
-
#initialize(opts = {}) ⇒ Admin
constructor
A new instance of Admin.
- #json(obj) ⇒ Object
Constructor Details
Instance Method Details
#deliver(obj, view) ⇒ Object
261 262 263 264 265 266 267 |
# File 'lib/cachai.rb', line 261 def deliver(obj, view) if request.xhr? json(obj) else erb view end end |
#json(obj) ⇒ Object
269 270 271 272 |
# File 'lib/cachai.rb', line 269 def json(obj) content_type 'application/json' return obj.is_a?(String) ? obj : obj.to_json end |