Sha256: ce6c5493bf91216620a224b4c3f737383f6557f0b91c10e4319316ec376856e8

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

# encoding: utf-8

module Veritas
  module SQL
    module Generator

      # Generates an SQL statement for a function expression
      module Function
        include Attribute, Literal

      private
        # Return the SQL for a umary prefix operation
        #
        # @param [#to_s] operator
        #
        # @param [Function::Unary] function
        #
        # @return [#to_s]
        #
        # @api private
        def unary_prefix_operation_sql(operator, function)
          "#{operator} (#{dispatch(function.operand)})"
        end

        # Return the SQL for a binary prefix operation
        #
        # @param [#to_s] operator
        #
        # @param [Function::Binary] function
        #
        # @return [#to_s]
        #
        # @api private
        def binary_prefix_operation_sql(operator, function)
          "#{operator} (#{dispatch(function.left)}, #{dispatch(function.right)})"
        end

        # Return the SQL for a binary infix operation
        #
        # @param [#to_s] operator
        #
        # @param [Function::Binary] function
        #
        # @return [#to_s]
        #
        # @api private
        def binary_infix_operation_sql(operator, function)
          "#{dispatch(function.left)} #{operator} #{dispatch(function.right)}"
        end

      end # module Function
    end # module Generator
  end # module SQL
end # module Veritas

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-sql-generator-0.0.7 lib/veritas/sql/generator/function.rb
veritas-sql-generator-0.0.6 lib/veritas/sql/generator/function.rb
veritas-sql-generator-0.0.5 lib/veritas/sql/generator/function.rb
veritas-sql-generator-0.0.4 lib/veritas/sql/generator/function.rb