Parent

Sprockets::SafetyColons

For JS developers who are colonfobic, concatenating JS files using the module pattern usually leads to syntax errors.

The `SafetyColons` processor will insert missing semicolons to the end of the file.

This behavior can be disabled with:

    environment.unregister_postprocessor 'application/javascript', Sprockets::SafetyColons

Public Instance Methods

evaluate(context, locals, &block) click to toggle source
    # File lib/sprockets/safety_colons.rb, line 18
18:     def evaluate(context, locals, &block)
19:       # If the file is blank or ends in a semicolon, leave it as is
20:       if data =~ /\A\s*\Z/ || data =~ /;\s*\Z/
21:         data
22:       else
23:         # Otherwise, append a semicolon and newline
24:         "#{data};\n"
25:       end
26:     end
prepare() click to toggle source
    # File lib/sprockets/safety_colons.rb, line 15
15:     def prepare
16:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.