Class: WikiObject
- Inherits:
-
Object
- Object
- WikiObject
- Includes:
- DataFactory, Foundry, StringFactory, Workflows
- Defined in:
- lib/sambal-cle/data_objects/wiki.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#href ⇒ Object
Returns the value of attribute href.
-
#site ⇒ Object
Returns the value of attribute site.
-
#title ⇒ Object
(also: #name)
Returns the value of attribute title.
Instance Method Summary collapse
- #create ⇒ Object
- #edit(opts = {}) ⇒ Object
- #get_content ⇒ Object
-
#initialize(browser, opts = {}) ⇒ WikiObject
constructor
A new instance of WikiObject.
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ WikiObject
Returns a new instance of WikiObject.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sambal-cle/data_objects/wiki.rb', line 10 def initialize(browser, opts={}) @browser = browser defaults = { :title=>random_alphanums, :content=>"{worksiteinfo}\n{sakai-sections}" } = defaults.merge(opts) () requires @site end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
8 9 10 |
# File 'lib/sambal-cle/data_objects/wiki.rb', line 8 def content @content end |
#href ⇒ Object
Returns the value of attribute href.
8 9 10 |
# File 'lib/sambal-cle/data_objects/wiki.rb', line 8 def href @href end |
#site ⇒ Object
Returns the value of attribute site.
8 9 10 |
# File 'lib/sambal-cle/data_objects/wiki.rb', line 8 def site @site end |
#title ⇒ Object Also known as: name
Returns the value of attribute title.
8 9 10 |
# File 'lib/sambal-cle/data_objects/wiki.rb', line 8 def title @title end |
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/sambal-cle/data_objects/wiki.rb', line 25 def create open_my_site_by_name @site wiki on Rwiki do |home| home.edit @current_content = home.content.value @updated_content = "[#{@title}]\n\n"+@current_content home.content.set @updated_content home.save @href = home.wiki_href "#{@title}?" home.open_wiki "#{@title}?" home.edit home.content.set @content home.save end end |
#edit(opts = {}) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/sambal-cle/data_objects/wiki.rb', line 42 def edit opts={} open_my_site_by_name @site wiki on Rwiki do |edit| edit.open_wiki @title edit.edit # TODO more here end (opts) end |
#get_content ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/sambal-cle/data_objects/wiki.rb', line 53 def get_content open_my_site_by_name @site wiki on Rwiki do |edit| edit.open_wiki @title edit.edit @content = edit.content.value end end |