Class: Moodle2CC::CanvasCC::Models::Page
- Defined in:
- lib/moodle2cc/canvas_cc/models/page.rb
Constant Summary collapse
- PAGE_ID_POSTFIX =
'_PAGE'
- WIKI_CONTENT =
'wiki_content'
- BOOK_PATH =
WIKI_CONTENT + '/books'
- EDITING_ROLE_TEACHER =
'teachers'
- MAX_URL_LENGTH =
80
Constants inherited from Resource
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#editing_roles ⇒ Object
Returns the value of attribute editing_roles.
-
#title ⇒ Object
Returns the value of attribute title.
-
#workflow_state ⇒ Object
Returns the value of attribute workflow_state.
Attributes inherited from Resource
#dependencies, #files, #href, #type
Class Method Summary collapse
Instance Method Summary collapse
- #identifier ⇒ Object
- #identifier=(identifier) ⇒ Object
-
#initialize ⇒ Page
constructor
A new instance of Page.
- #page_name=(name) ⇒ Object
Methods inherited from Resource
Constructor Details
#initialize ⇒ Page
Returns a new instance of Page.
14 15 16 17 |
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 14 def initialize super @type = WEB_CONTENT_TYPE end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
12 13 14 |
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 12 def body @body end |
#editing_roles ⇒ Object
Returns the value of attribute editing_roles.
12 13 14 |
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 12 def editing_roles @editing_roles end |
#title ⇒ Object
Returns the value of attribute title.
12 13 14 |
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 12 def title @title end |
#workflow_state ⇒ Object
Returns the value of attribute workflow_state.
12 13 14 |
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 12 def workflow_state @workflow_state end |
Class Method Details
.convert_name_to_url(name) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 31 def self.convert_name_to_url(name) url = CGI::escape(name.downcase.gsub(/\s/, '-').gsub('.', 'dot')) if url.length > MAX_URL_LENGTH url = url[0,MAX_URL_LENGTH][/.{0,#{MAX_URL_LENGTH}}/mu] end url end |
Instance Method Details
#identifier ⇒ Object
23 24 25 |
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 23 def identifier @identifier end |
#identifier=(identifier) ⇒ Object
19 20 21 |
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 19 def identifier=(identifier) @identifier = identifier end |
#page_name=(name) ⇒ Object
27 28 29 |
# File 'lib/moodle2cc/canvas_cc/models/page.rb', line 27 def page_name= name @title = name end |