Class: Gollum::Macro

Inherits:
Object
  • Object
show all
Defined in:
lib/gollum-lib/macro.rb,
lib/gollum-lib/macro/series.rb,
lib/gollum-lib/macro/all_pages.rb,
lib/gollum-lib/macro/global_toc.rb,
lib/gollum-lib/macro/navigation.rb

Direct Known Subclasses

AllPages, GlobalTOC, Navigation, Series, Unknown_Macro

Defined Under Namespace

Classes: AllPages, GlobalTOC, Navigation, Series, SeriesEnd, SeriesStart, Unknown_Macro

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wiki, page) ⇒ Macro

Returns a new instance of Macro.



12
13
14
15
# File 'lib/gollum-lib/macro.rb', line 12

def initialize(wiki, page)
  @wiki = wiki
  @page = page
end

Class Method Details

.instance(macro_name, wiki, page) ⇒ Object

Find the macro named, create an instance of that, and return it



4
5
6
7
8
9
10
# File 'lib/gollum-lib/macro.rb', line 4

def self.instance(macro_name, wiki, page)
  begin
    self.const_get(macro_name).new(wiki, page)
  rescue NameError
    Unknown_Macro.new(macro_name)
  end
end

Instance Method Details

#render(*_args) ⇒ Object

Raises:

  • (ArgumentError)


17
18
19
20
21
# File 'lib/gollum-lib/macro.rb', line 17

def render(*_args)
  raise ArgumentError,
        "#{self.class} does not implement #render.  "+
        "This is a bug in #{self.class}."
end