Class: DynamicMigrations::Postgres::Server::Database::Source
- Inherits:
-
Object
- Object
- DynamicMigrations::Postgres::Server::Database::Source
- Defined in:
- lib/dynamic_migrations/postgres/server/database/source.rb
Direct Known Subclasses
Schema, DynamicMigrations::Postgres::Server::Database::Schema::Enum, DynamicMigrations::Postgres::Server::Database::Schema::Function, DynamicMigrations::Postgres::Server::Database::Schema::Table, DynamicMigrations::Postgres::Server::Database::Schema::Table::Column, DynamicMigrations::Postgres::Server::Database::Schema::Table::ForeignKeyConstraint, DynamicMigrations::Postgres::Server::Database::Schema::Table::Index, DynamicMigrations::Postgres::Server::Database::Schema::Table::PrimaryKey, DynamicMigrations::Postgres::Server::Database::Schema::Table::Trigger, DynamicMigrations::Postgres::Server::Database::Schema::Table::UniqueConstraint, DynamicMigrations::Postgres::Server::Database::Schema::Table::Validation
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #assert_is_a_symbol!(value) ⇒ Object
- #from_configuration? ⇒ Boolean
- #from_database? ⇒ Boolean
-
#initialize(source) ⇒ Source
constructor
initialize a new object to represent a postgres schema.
Constructor Details
#initialize(source) ⇒ Source
initialize a new object to represent a postgres schema
11 12 13 14 15 16 |
# File 'lib/dynamic_migrations/postgres/server/database/source.rb', line 11 def initialize source unless source == :configuration || source == :database raise InvalidSourceError, source end @source = source end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
8 9 10 |
# File 'lib/dynamic_migrations/postgres/server/database/source.rb', line 8 def source @source end |
Instance Method Details
#assert_is_a_symbol!(value) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/dynamic_migrations/postgres/server/database/source.rb', line 26 def assert_is_a_symbol! value if value.is_a? Symbol true else raise ExpectedSymbolError, "expected Symbol but got #{value}" end end |
#from_configuration? ⇒ Boolean
18 19 20 |
# File 'lib/dynamic_migrations/postgres/server/database/source.rb', line 18 def from_configuration? @source == :configuration end |
#from_database? ⇒ Boolean
22 23 24 |
# File 'lib/dynamic_migrations/postgres/server/database/source.rb', line 22 def from_database? @source == :database end |