Class: Gollum::Wiki

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

Direct Known Subclasses

Smeagol::Wiki

Instance Method Summary collapse

Instance Method Details

#file_list(ref) ⇒ Object

Fill an array with a list of files.

Parameters:

  • ref

    A String ref that is either a commit SHA or references one.

Returns:

  • a flat Array of Gollum::File instances.



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/smeagol/gollum/wiki.rb', line 18

def file_list(ref)
  if sha = @access.ref_to_sha(ref)
    commit = @access.commit(sha)
    tree_map_for(sha).inject([]) do |list, entry|
      next list if @page_class.valid_page_name?(entry.name)
      list << entry.file(self, commit)
    end
  else
    []
  end
end

#files(treeish = nil) ⇒ Object

Lists all non-page files for this wiki.

Parameters:

  • treeish (defaults to: nil)

    The String commit ID or ref to find (default: @ref)

Returns:

  • an Array of Gollum::File instances.



9
10
11
# File 'lib/smeagol/gollum/wiki.rb', line 9

def files(treeish = nil)
  file_list(treeish || @ref)
end