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.7.4 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.3 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.2 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.1 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.7.0 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.6.5 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.6.4 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.6.3 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.6.2 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.6.1 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.6.0 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.5.1 lib/liquidscript/generator/javascript/exceptions.rb
liquidscript-0.5.0 lib/liquidscript/generator/javascript/exceptions.rb