Class: PgObjects::DbObject
- Inherits:
-
Object
- Object
- PgObjects::DbObject
- Defined in:
- lib/pg_objects/db_object.rb
Overview
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
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#full_name ⇒ Object
readonly
Returns the value of attribute full_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#object_name ⇒ Object
readonly
Returns the value of attribute object_name.
-
#sql_query ⇒ Object
readonly
Returns the value of attribute sql_query.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(file_path) ⇒ DbObject
constructor
A new instance of DbObject.
Constructor Details
#initialize(file_path) ⇒ DbObject
Returns a new instance of DbObject.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pg_objects/db_object.rb', line 12 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 |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
9 10 11 |
# File 'lib/pg_objects/db_object.rb', line 9 def dependencies @dependencies end |
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name.
9 10 11 |
# File 'lib/pg_objects/db_object.rb', line 9 def full_name @full_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/pg_objects/db_object.rb', line 9 def name @name end |
#object_name ⇒ Object (readonly)
Returns the value of attribute object_name.
9 10 11 |
# File 'lib/pg_objects/db_object.rb', line 9 def object_name @object_name end |
#sql_query ⇒ Object (readonly)
Returns the value of attribute sql_query.
9 10 11 |
# File 'lib/pg_objects/db_object.rb', line 9 def sql_query @sql_query end |
#status ⇒ Object
Returns the value of attribute status.
10 11 12 |
# File 'lib/pg_objects/db_object.rb', line 10 def status @status end |