Class: DynamicMigrations::Postgres::Server::Database::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamic_migrations/postgres/server/database/source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#sourceObject (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

Returns:

  • (Boolean)


18
19
20
# File 'lib/dynamic_migrations/postgres/server/database/source.rb', line 18

def from_configuration?
  @source == :configuration
end

#from_database?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/dynamic_migrations/postgres/server/database/source.rb', line 22

def from_database?
  @source == :database
end