class JAPR::Converter
Base class for asset converters See github.com/janosrusiczki/japr#asset-preprocessing
Attributes
converted[R]
Public Class Methods
filetype()
click to toggle source
Filetype to process (e.g. '.coffee')
# File lib/japr/converter.rb, line 19 def self.filetype '' end
klass(filename)
click to toggle source
Finds a converter class based on a filename
# File lib/japr/converter.rb, line 24 def self.klass(filename) JAPR::Converter.subclasses.select do |c| c.filetype == File.extname(filename).downcase end.last end
new(asset)
click to toggle source
# File lib/japr/converter.rb, line 9 def initialize(asset) @content = asset.content @type = File.extname(asset.filename).downcase @dirname = asset.dirname @converted = convert end
Public Instance Methods
convert()
click to toggle source
Logic to convert assets
Available instance variables: @file File to be converted @content Contents of @file as a string @type Filetype of file (e.g. '.coffee')
Returns converted string
# File lib/japr/converter.rb, line 38 def convert @content end