Sha256: ef187bf72f9ca1da9bccad4772a66642210f6570977b79e0b7de9ba95194b0d0

Contents?: true

Size: 491 Bytes

Versions: 3

Compression:

Stored size: 491 Bytes

Contents

module Fx
  # @api private
  class Function
    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

3 entries across 3 versions & 1 rubygems

Version Path
fx-0.3.0 lib/fx/function.rb
fx-0.2.0 lib/fx/function.rb
fx-0.1.0 lib/fx/function.rb