class Haml::RubyExpression
Public Class Methods
string_literal?(code)
click to toggle source
# File lib/haml/ruby_expression.rb, line 15 def self.string_literal?(code) return false if syntax_error?(code) type, instructions = Ripper.sexp(code) return false if type != :program return false if instructions.size > 1 type, _ = instructions.first type == :string_literal end
syntax_error?(code)
click to toggle source
# File lib/haml/ruby_expression.rb, line 8 def self.syntax_error?(code) self.new(code).parse false rescue ParseError true end
Private Instance Methods
on_parse_error(*)
click to toggle source
# File lib/haml/ruby_expression.rb, line 28 def on_parse_error(*) raise ParseError end