Sha256: ca313551811a53d898c0e36c1cab9ffd4971ffc507f0e7bcf39ee579f6b37401

Contents?: true

Size: 718 Bytes

Versions: 18

Compression:

Stored size: 718 Bytes

Contents

module PgObjects
  ##
  # Represents DB object as it is described in file
  #
  # [name]  name of file without extension
  # [full_name] full pathname of file
  # [object_name] name of function, trigger etc. if it was successfully parsed, otherwise - nil
  class DbObject
    attr_reader :sql_query, :name, :full_name, :object_name, :dependencies
    attr_accessor :status

    def initialize(file_path)
      @full_name = file_path
      @name = File.basename file_path, '.*'
      @sql_query = File.read file_path

      directives = Parser.fetch_directives @sql_query
      @dependencies = directives[:depends_on]
      @object_name = Parser.fetch_object_name @sql_query

      @status = :pending
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
pg_objects-1.0.3 lib/pg_objects/db_object.rb
pg_objects-1.0.2 lib/pg_objects/db_object.rb
pg_objects-1.0.1 lib/pg_objects/db_object.rb
pg_objects-1.0.0 lib/pg_objects/db_object.rb
pg_objects-0.5.13 lib/pg_objects/db_object.rb
pg_objects-0.5.12 lib/pg_objects/db_object.rb
pg_objects-0.5.11 lib/pg_objects/db_object.rb
pg_objects-0.5.10 lib/pg_objects/db_object.rb
pg_objects-0.5.9 lib/pg_objects/db_object.rb
pg_objects-0.5.8 lib/pg_objects/db_object.rb
pg_objects-0.5.7 lib/pg_objects/db_object.rb
pg_objects-0.5.6 lib/pg_objects/db_object.rb
pg_objects-0.5.5 lib/pg_objects/db_object.rb
pg_objects-0.5.4 lib/pg_objects/db_object.rb
pg_objects-0.5.3 lib/pg_objects/db_object.rb
pg_objects-0.5.2 lib/pg_objects/db_object.rb
pg_objects-0.4.4 lib/pg_objects/db_object.rb
pg_objects-0.4.3 lib/pg_objects/db_object.rb