Module: DynamicMigrations::Postgres::Server::Database::ConfiguredExtensions
- Included in:
- DynamicMigrations::Postgres::Server::Database
- Defined in:
- lib/dynamic_migrations/postgres/server/database/configured_extensions.rb
Defined Under Namespace
Classes: ConfiguredExtensionAlreadyExistsError
Instance Method Summary collapse
-
#add_configured_extension(extension_name) ⇒ Object
adds a new configured extension for this database.
-
#configured_extensions ⇒ Object
returns an array of this tables configured extensions.
-
#has_configured_extension?(extension_name) ⇒ Boolean
returns true if this table has a configured extension with the provided name, otherwise false.
Instance Method Details
#add_configured_extension(extension_name) ⇒ Object
adds a new configured extension for this database
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dynamic_migrations/postgres/server/database/configured_extensions.rb', line 12 def add_configured_extension extension_name raise ExpectedSymbolError, extension_name unless extension_name.is_a? Symbol if has_configured_extension? extension_name raise(ConfiguredExtensionAlreadyExistsError, "Configured extension #{extension_name} already exists") end # sort the hash so that the extensions are in alphabetical order by name @configured_extensions[extension_name] = true sorted_extensions = {} @configured_extensions.keys.sort.each do |extension_name| sorted_extensions[extension_name] = true end @configured_extensions = sorted_extensions end |
#configured_extensions ⇒ Object
returns an array of this tables configured extensions
33 34 35 |
# File 'lib/dynamic_migrations/postgres/server/database/configured_extensions.rb', line 33 def configured_extensions @configured_extensions.keys end |
#has_configured_extension?(extension_name) ⇒ Boolean
returns true if this table has a configured extension with the provided name, otherwise false
27 28 29 30 |
# File 'lib/dynamic_migrations/postgres/server/database/configured_extensions.rb', line 27 def has_configured_extension? extension_name raise ExpectedSymbolError, extension_name unless extension_name.is_a? Symbol @configured_extensions.key? extension_name end |