Class: LegalBeagle::Converter
- Inherits:
-
Object
- Object
- LegalBeagle::Converter
- Includes:
- Jekyll::Convertible
- Defined in:
- lib/legal_beagle/converter.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#data ⇒ Object
Returns the value of attribute data.
-
#ext ⇒ Object
Returns the value of attribute ext.
Instance Method Summary collapse
-
#initialize(filename) ⇒ Converter
constructor
A new instance of Converter.
- #render(pdf) ⇒ Object
- #transform ⇒ Object
Constructor Details
#initialize(filename) ⇒ Converter
Returns a new instance of Converter.
11 12 13 14 15 16 |
# File 'lib/legal_beagle/converter.rb', line 11 def initialize(filename) file = Pathname.new(filename) self.ext = file.extname self.content = file.read read_yaml(file.dirname, file.basename) end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
9 10 11 |
# File 'lib/legal_beagle/converter.rb', line 9 def content @content end |
#data ⇒ Object
Returns the value of attribute data.
9 10 11 |
# File 'lib/legal_beagle/converter.rb', line 9 def data @data end |
#ext ⇒ Object
Returns the value of attribute ext.
9 10 11 |
# File 'lib/legal_beagle/converter.rb', line 9 def ext @ext end |
Instance Method Details
#render(pdf) ⇒ Object
22 23 24 25 26 |
# File 'lib/legal_beagle/converter.rb', line 22 def render(pdf) @pdf = pdf self.content = Liquid::Template.parse(self.content).render(data, {}) self.transform end |
#transform ⇒ Object
18 19 20 |
# File 'lib/legal_beagle/converter.rb', line 18 def transform Maruku.new(content).to_prawn(@pdf) end |