Module: RailsErbCheck

Defined in:
lib/rails-erb-check.rb

Class Method Summary collapse

Class Method Details

.valid_syntax?(erb) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
12
# File 'lib/rails-erb-check.rb', line 4

def self.valid_syntax?(erb)
  begin
    ActionView::Template::Handlers::Erubis.new(erb).result
  rescue SyntaxError
    return false
  rescue Exception
    return true
  end
end