Class: SyllabusObject
- Inherits:
-
Object
- Object
- SyllabusObject
- Includes:
- DataFactory, Foundry, StringFactory, Workflows
- Defined in:
- lib/sambal-cle/data_objects/syllabus.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#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_properties ⇒ Object
-
#initialize(browser, opts = {}) ⇒ SyllabusObject
constructor
A new instance of SyllabusObject.
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ SyllabusObject
Returns a new instance of SyllabusObject.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sambal-cle/data_objects/syllabus.rb', line 10 def initialize(browser, opts={}) @browser = browser defaults = { :title=>random_alphanums, :content=>random_multiline(50, 5, :alpha) } = 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/syllabus.rb', line 8 def content @content end |
#site ⇒ Object
Returns the value of attribute site.
8 9 10 |
# File 'lib/sambal-cle/data_objects/syllabus.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/syllabus.rb', line 8 def title @title end |
Instance Method Details
#create ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sambal-cle/data_objects/syllabus.rb', line 24 def create open_my_site_by_name @site syllabus on Syllabus do |add| add.create_edit add.add end on AddEditSyllabusItem do |create| create.title.set @title create.enter_source_text create.editor, @content create.post end end |
#edit(opts = {}) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/sambal-cle/data_objects/syllabus.rb', line 38 def edit opts={} open_my_site_by_name @site syllabus on Syllabus do |syllabus| reset syllabus.create_edit end on SyllabusEdit do |edit| edit.open_item @title end on AddEditSyllabusItem do |item| item.title.fit opts[:title] item.enter_source_text(item.editor, opts[:content]) unless opts[:content]==nil end (opts) end |
#get_properties ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/sambal-cle/data_objects/syllabus.rb', line 55 def get_properties open_my_site_by_name @site syllabus on Syllabus do |syllabus| reset syllabus.create_edit end on SyllabusEdit do |edit| edit.open_item @title end on AddEditSyllabusItem do |item| @content = item.get_source_text(item.editor) # Add more here as necessary... end end |