Sha256: 74310d36ccabbb0c1138d65d776b390940df1c0f320f287bac035211eb992b38

Contents?: true

Size: 825 Bytes

Versions: 33

Compression:

Stored size: 825 Bytes

Contents

module Liquidscript
  module Generator
    class Javascript < Base
      module Exceptions

        def generate_try(code)
          out = buffer
          out << "try {\n"
          insert_into(code[1], out)
          out << indent_level << "}"

          if code[2]
            out << replace(code[2])
          end

          out
        end

        def generate_catch(code)
          out = buffer
          out << "catch(#{code[1].value}) {\n"
          insert_into(code[2], out)
          out << indent_level << "}"

          if code[3]
            out << replace(code[3])
          end

          out
        end

        def generate_finally(code)
          out = buffer
          out << "finally {\n"
          insert_into(code[1], out)
          out << indent_level << "}"
        end

      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
liquidscript-0.11.0.rc1 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.10.4 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.10.3 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.10.2 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.10.1 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.10.0 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.9.2 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.9.1 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.9.0 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.8.2 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.8.1 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.8.0 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.12 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.11 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.10 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.9 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.8 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.7 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.6 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.5 lib/liquidscript/generator/javascript/exceptions.rb