Sha256: 74a2383a0d198e5675eadf5e1c99352cd5a808efa785b0971c0cf2fb5a87ec5a

Contents?: true

Size: 484 Bytes

Versions: 2

Compression:

Stored size: 484 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

2 entries across 2 versions & 1 rubygems

Version Path
scenic-0.2.1 lib/scenic/view.rb
scenic-0.2.0 lib/scenic/view.rb