Module: EtherpadLite::Padded
Overview
Methods for dealing with pads belonging to something. Both Instance and Group include this, as they each have pads. This will work with any object which has an instance method, returning an EtherpadLite Instance object.
Instance Method Summary collapse
-
#create_pad(id, options = {}) ⇒ Object
Creates and returns a Pad with the given id.
-
#get_pad(id, options = {}) ⇒ Object
Returns the Pad with the given id (presumed to already exist).
-
#pad(id, options = {}) ⇒ Object
Returns the Pad with the given id, creating it if it doesn’t already exist.
Instance Method Details
#create_pad(id, options = {}) ⇒ Object
Creates and returns a Pad with the given id.
Options:
text => ‘initial Pad text’
27 28 29 |
# File 'lib/etherpad-lite/models/padded.rb', line 27 def create_pad(id, ={}) Pad.create instance, id, end |
#get_pad(id, options = {}) ⇒ Object
Returns the Pad with the given id (presumed to already exist). Use this instead of Instance#pad when you know the Pad already exists; it will save an HTTP request.
18 19 20 |
# File 'lib/etherpad-lite/models/padded.rb', line 18 def get_pad(id, ={}) Pad.new instance, id, end |
#pad(id, options = {}) ⇒ Object
Returns the Pad with the given id, creating it if it doesn’t already exist. This requires an HTTP request, so if you know the Pad already exists, use Instance#get_pad instead.
7 8 9 10 11 12 13 14 |
# File 'lib/etherpad-lite/models/padded.rb', line 7 def pad(id, ={}) begin Pad.create(instance, id, ) # Pad alreaded exists rescue Error Pad.new(instance, id, ) end end |