Sha256: ae62e6b8a124a61a7f2e0424a0af2534fe23de4d2cf9cac4cb08e21fd943cd30

Contents?: true

Size: 515 Bytes

Versions: 6

Compression:

Stored size: 515 Bytes

Contents

module Fx
  # @api private
  class Function
    include Comparable

    attr_reader :name, :definition
    delegate :<=>, to: :name

    def initialize(function_row)
      @name = function_row.fetch("name")
      @definition = function_row.fetch("definition")
    end

    def ==(other)
      name == other.name && definition == other.definition
    end

    def to_schema
      <<-SCHEMA.indent(2)
create_function :#{name}, sql_definition: <<-\SQL
#{definition.indent(4).rstrip}
SQL
      SCHEMA
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fx-0.6.2 lib/fx/function.rb
fx-0.6.1 lib/fx/function.rb
fx-0.6.0 lib/fx/function.rb
fx-0.5.0 lib/fx/function.rb
fx-0.4.0 lib/fx/function.rb
fx-0.3.1 lib/fx/function.rb