Sha256: 0264728086201332603455c41a21a7545dd412e6e89a10a0bfd464fa77080c02

Contents?: true

Size: 614 Bytes

Versions: 27

Compression:

Stored size: 614 Bytes

Contents

module Knitkit
  class SyntaxValidator
    class << self

      def validate_content(file_type, content)
        case file_type.to_sym
        when :erb
          validate_erb(content)
        else
          return nil
        end
      end

      def validate_file(file)
        #stubbed for later development
      end

      private

      def validate_erb(contents)
        begin
          ActionView::Template::Handlers::Erubis.new(contents).result
        rescue SyntaxError=>ex
          ex.message
        rescue Exception=>ex
          nil
        end
      end

    end
  end#SyntaxValidator
end#Knitkit

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
knitkit-2.1.15 lib/knitkit/syntax_validator.rb
knitkit-2.1.14 lib/knitkit/syntax_validator.rb
knitkit-2.1.13 lib/knitkit/syntax_validator.rb
knitkit-2.1.12 lib/knitkit/syntax_validator.rb
knitkit-2.1.11 lib/knitkit/syntax_validator.rb
knitkit-2.1.10 lib/knitkit/syntax_validator.rb
knitkit-2.1.9 lib/knitkit/syntax_validator.rb
knitkit-2.1.8 lib/knitkit/syntax_validator.rb
knitkit-2.1.7 lib/knitkit/syntax_validator.rb
knitkit-2.1.6 lib/knitkit/syntax_validator.rb
knitkit-2.1.5 lib/knitkit/syntax_validator.rb
knitkit-2.1.4 lib/knitkit/syntax_validator.rb
knitkit-2.1.3 lib/knitkit/syntax_validator.rb
knitkit-2.1.2 lib/knitkit/syntax_validator.rb
knitkit-2.1.1 lib/knitkit/syntax_validator.rb
knitkit-2.1.0 lib/knitkit/syntax_validator.rb
knitkit-2.0.11 lib/knitkit/syntax_validator.rb
knitkit-2.0.10 lib/knitkit/syntax_validator.rb
knitkit-2.0.9 lib/knitkit/syntax_validator.rb
knitkit-2.0.7 lib/knitkit/syntax_validator.rb