class Pakyow::Generator::Processor
Constants
- PATH_VAR_REGEX
Public Instance Methods
populate_path(file)
click to toggle source
# File lib/pakyow/generator.rb, line 131 def populate_path(file) file.logical_path.scan(PATH_VAR_REGEX).each do |match| file.logical_path.gsub!("%#{match[0]}%", file.context.send(match[0].to_sym)) end end
process_erb(file)
click to toggle source
# File lib/pakyow/generator.rb, line 110 def process_erb(file) if ::File.extname(file.logical_path) == ".erb" file.logical_path = ::File.join( ::File.dirname(file.logical_path), ::File.basename(file.logical_path, ".erb") ) erb = if RUBY_VERSION.start_with?("2.5") ERB.new(file.content, nil, "%<>-") else ERB.new(file.content, trim_mode: "%-") end file.content = erb.result( file.context.instance_eval { binding } ) end end