Sha256: 3b0b5d549dcf8fd9b709561da26e6f955b7fab2166fbd5836ee7b9a5f486a7d5

Contents?: true

Size: 834 Bytes

Versions: 1

Compression:

Stored size: 834 Bytes

Contents

module Ruboto
  module Util
    module CodeFormatting
      ###########################################################################
      #
      # Methods for formatting code
      #
      def method_call(return_type=nil, method_name="", parameters=[], body_clause=[])
        ["public #{"#{return_type} " unless return_type.nil? || return_type.empty?}#{method_name}(" + parameters.map{|i| "#{i[1]} #{i[0]}"}.join(", ") + ") {",
        body_clause.indent, "}"]
      end

      def if_else(condition, if_clause, else_clause)
        ["if (#{condition}) {", if_clause.indent, else_clause.compact.empty? ? nil : "} else {", else_clause.indent, "}"]
      end

      def try_catch(try_clause, catch_clause)
        ["try {", try_clause.indent, "} catch (RaiseException re) {", catch_clause.indent, "}"]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruboto-0.8.0 lib/ruboto/util/code_formatting.rb