Class: NewSnip

Inherits:
Dynasnip show all
Includes:
Login::Helper
Defined in:
lib/vanilla/dynasnips/new.rb

Instance Attribute Summary

Attributes inherited from Vanilla::Renderers::Base

#app

Instance Method Summary collapse

Methods included from Login::Helper

#current_user, #logged_in?, #login_required

Methods inherited from Dynasnip

all, attribute, build_snip, #method_missing, persist!, persist_all!, snip_attributes, snip_name, usage

Methods inherited from Vanilla::Renderers::Base

escape_curly_braces, #include_snips, #initialize, #prepare, #process_text, #raw_content, render, #render, #render_without_including_snips, snip_regexp

Constructor Details

This class inherits a constructor from Vanilla::Renderers::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Dynasnip

Instance Method Details

#handle(*arg) ⇒ Object



9
10
11
12
13
# File 'lib/vanilla/dynasnips/new.rb', line 9

def handle(*arg)
  return  unless logged_in?
  base_params = {:render_as => '', :content => '', :author => current_user}.update(app.request.params)
  editor = EditSnip.new(app).edit(Snip.new(base_params))
end