Class: Grouik::Formatter
- Inherits:
-
Object
- Object
- Grouik::Formatter
- Defined in:
- src/lib/grouik/formatter.rb
Overview
Formatter used to render loadables
Instance Attribute Summary collapse
-
#loadables ⇒ Object
readonly
Returns the value of attribute loadables.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
- #template ⇒ Pathname|nil readonly
Class Method Summary collapse
Instance Method Summary collapse
- #format ⇒ Object
- #formatted ⇒ Object
-
#initialize(loadables, options = {}) ⇒ Formatter
constructor
A new instance of Formatter.
- #to_s ⇒ Object
Constructor Details
#initialize(loadables, options = {}) ⇒ Formatter
Returns a new instance of Formatter.
18 19 20 21 22 23 24 |
# File 'src/lib/grouik/formatter.rb', line 18 def initialize(loadables, = {}) @loadables = loadables @options = @formatted = nil @engine = Tenjin::Engine.new(cache: false) @template = [:template] end |
Instance Attribute Details
#loadables ⇒ Object (readonly)
Returns the value of attribute loadables.
15 16 17 |
# File 'src/lib/grouik/formatter.rb', line 15 def loadables @loadables end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
14 15 16 |
# File 'src/lib/grouik/formatter.rb', line 14 def @options end |
#template ⇒ Pathname|nil (readonly)
27 28 29 |
# File 'src/lib/grouik/formatter.rb', line 27 def template @template end |
Class Method Details
.format(loadables, options = {}) ⇒ Object
47 48 49 |
# File 'src/lib/grouik/formatter.rb', line 47 def format(loadables, = {}) self.new(loadables, ).format end |
Instance Method Details
#format ⇒ Object
35 36 37 38 39 |
# File 'src/lib/grouik/formatter.rb', line 35 def format @formatted = @formatted.nil? ? output : @formatted return self end |
#formatted ⇒ Object
41 42 43 44 |
# File 'src/lib/grouik/formatter.rb', line 41 def formatted format @formatted.clone end |
#to_s ⇒ Object
31 32 33 |
# File 'src/lib/grouik/formatter.rb', line 31 def to_s formatted end |