module GollumRails::Core
Constants
- ATTR_ACCESSORS
- ATTR_READERS
- ATTR_WRITERS
Public Class Methods
new(attrs = {}) { |self| ... }
click to toggle source
Initializes a new Page
attrs - Hash of attributes
commit must be given to perform any page action!
# File lib/gollum_rails/core.rb, line 56 def initialize(attrs = {}) assign_attributes(attrs) _update_page_attributes if attrs[:gollum_page] yield self if block_given? run_callbacks :initialize unless _initialize_callbacks.empty? end
Public Instance Methods
canonicalized_filename()
click to toggle source
Gets a canonicalized filename of the page
# File lib/gollum_rails/core.rb, line 86 def canonicalized_filename Gollum::Page.canonicalize_filename(name) end
compare_commits(sha1,sha2=nil)
click to toggle source
content()
click to toggle source
# File lib/gollum_rails/core.rb, line 192 def content @content ||= (@gollum_page.content || "") end
current_version(long=false)
click to toggle source
filename(ext=true)
click to toggle source
format()
click to toggle source
Gets the pages format
# File lib/gollum_rails/core.rb, line 177 def format (@format || (@gollum_page.format||:markdown)).to_sym end
history()
click to toggle source
html_data()
click to toggle source
last_changed_by()
click to toggle source
name()
click to toggle source
# File lib/gollum_rails/core.rb, line 181 def name @name ||= (@gollum_page.name || "") end
preview(format=:markdown)
click to toggle source
Previews the page - Mostly used if you want to see what you do before saving¶ ↑
This is an extremely fast method! 1 rendering attempt take depending on the content about 0.001 (simple markdown) upto 0.004 (1000 chars markdown) seconds, which is quite good
format - Specify the format you want to render with see {self.format_supported?}
for formats
Returns a String
# File lib/gollum_rails/core.rb, line 101 def preview(format=:markdown) require 'active_support/core_ext/string/output_safety' wiki.preview_page(name, content, format).formatted_data.html_safe end
raw_data()
click to toggle source
sub_page?()
click to toggle source
title()
click to toggle source
to_param()
click to toggle source
# File lib/gollum_rails/core.rb, line 196 def to_param name end
Private Instance Methods
_update_page_attributes()
click to toggle source
get_right_commit(commit_local)
click to toggle source