class Knitkit::SyntaxValidator

Public Class Methods

validate_content(file_type, content) click to toggle source
# File lib/knitkit/syntax_validator.rb, line 5
def validate_content(file_type, content)
  case file_type.to_sym
  when :erb
    validate_erb(content)
  else
    return nil
  end
end
validate_file(file) click to toggle source
# File lib/knitkit/syntax_validator.rb, line 14
def validate_file(file)
  #stubbed for later development
end

Private Class Methods

validate_erb(contents) click to toggle source
# File lib/knitkit/syntax_validator.rb, line 20
def validate_erb(contents)
  begin
    ActionView::Template::Handlers::Erubis.new(contents).result
  rescue SyntaxError=> ex
    ex.message
  rescue => ex
    nil
  end
end