Class: Pekky::Format::Formatters

Inherits:
Wrapper
  • Object
show all
Defined in:
lib/pekky/format.rb

Overview

The formatter wrapper. Adds a few additional methods for defaults etc.

Class Method Summary collapse

Methods inherited from Wrapper

[], add, each, keys, method_missing, values

Class Method Details

.defaultsObject

Returns the default text formatter – textile



72
73
74
# File 'lib/pekky/format.rb', line 72

def self.defaults
  Config[:text_formatter]
end

.format(name, text, opts = {}) ⇒ Object

Call the renderer by name rather than having the code drop down to method missing. This will mainly be used internally in Pekky.



84
85
86
# File 'lib/pekky/format.rb', line 84

def self.format(name, text, opts = {})
  self.klasses[name]._format(text, opts)
end

.text(text, opts = {}) ⇒ Object

This is the default formatter. It’ll use the setting set in the site config, or the built in default – textile.



78
79
80
# File 'lib/pekky/format.rb', line 78

def self.text(text, opts = {})
  self.klasses[defaults]._format(text, opts)
end