Class: Monocle::Server

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/monocle/server.rb

Instance Method Summary collapse

Instance Method Details

#click_object(type, id, redirect_to) ⇒ Object



30
31
32
33
34
35
# File 'lib/monocle/server.rb', line 30

def click_object(type, id, redirect_to)
  if object = type.classify.constantize.find(id)
    object.click!
    redirect(Base64.decode64(URI.unescape(redirect_to)), 301)
  end
end

#view_object(type, id) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/monocle/server.rb', line 21

def view_object(type, id)
  if object = type.classify.constantize.find(id)
    object.view!
    'o_0 +1'
  else
    'o_0'
  end
end