Class: Plate::Compiler
- Inherits:
-
Object
- Object
- Plate::Compiler
- Defined in:
- lib/plate/compiler.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#repeating ⇒ Object
Returns the value of attribute repeating.
Instance Method Summary collapse
- #compile(code) ⇒ Object
- #fonts ⇒ Object
-
#initialize ⇒ Compiler
constructor
A new instance of Compiler.
- #repeating? ⇒ Boolean
Constructor Details
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
6 7 8 |
# File 'lib/plate/compiler.rb', line 6 def body @body end |
#meta ⇒ Object
Returns the value of attribute meta.
6 7 8 |
# File 'lib/plate/compiler.rb', line 6 def @meta end |
#repeating ⇒ Object
Returns the value of attribute repeating.
6 7 8 |
# File 'lib/plate/compiler.rb', line 6 def repeating @repeating end |
Instance Method Details
#compile(code) ⇒ Object
12 13 14 15 16 |
# File 'lib/plate/compiler.rb', line 12 def compile(code) self.body = @parser .parse(code) .compile(self) end |
#fonts ⇒ Object
18 19 20 21 22 23 |
# File 'lib/plate/compiler.rb', line 18 def fonts return '' if .nil? || ['fonts'].nil? ['fonts'].map { |font| "<link href=\"http://fonts.googleapis.com/css?family=#{CGI.escape(font)}\" rel=\"stylesheet\">" }.join("") end |
#repeating? ⇒ Boolean
25 26 27 |
# File 'lib/plate/compiler.rb', line 25 def repeating? repeating end |