Sha256: 576da813ee69aba449e5ea7751689594b22a8d3d60f61335acca637b1da9e37a

Contents?: true

Size: 485 Bytes

Versions: 1

Compression:

Stored size: 485 Bytes

Contents

module Scenic
  class View
    attr_reader :name, :definition
    delegate :<=>, to: :name

    def initialize(view_row)
      @name = view_row["viewname"]
      @definition = view_row["definition"].strip
    end

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

    def to_schema
      <<-DEFINITION.strip_heredoc
        create_view :#{name}, sql_definition:<<-\SQL
          #{definition}
        SQL

      DEFINITION
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scenic-0.3.0 lib/scenic/view.rb