Class: Gollum::File

Inherits:
Object
  • Object
show all
Defined in:
lib/smeagol/gollum/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#versionObject

The current version of the page.

Returns:

  • the Grit::Commit.



24
25
26
# File 'lib/smeagol/gollum/file.rb', line 24

def version
  @version
end

#wikiObject (readonly)

Returns the value of attribute wiki.



19
20
21
# File 'lib/smeagol/gollum/file.rb', line 19

def wiki
  @wiki
end

Instance Method Details

#extnameObject



39
40
41
# File 'lib/smeagol/gollum/file.rb', line 39

def extname
  ::File.extname(path)
end

#populate(blob, path = nil) ⇒ Object

Populate the Page with information from the Blob.

Parameters:

  • blob

    The Grit::Blob that contains the info.

  • path (defaults to: nil)

    The String directory path of the page file.

Returns:

  • the populated Gollum::Page.



12
13
14
15
16
# File 'lib/smeagol/gollum/file.rb', line 12

def populate(blob, path=nil)
  @blob = blob
  @path = "#{path}/#{blob.name}"[1..-1]
  self
end

#titleObject

The title will be constructed from the filename by stripping the extension and replacing any dashes with spaces.

Returns:

  • the fully sanitized String title.



34
35
36
# File 'lib/smeagol/gollum/file.rb', line 34

def title
  Sanitize.clean(name).strip
end