Class: TableSaw::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/table_saw/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dbnameObject

Returns the value of attribute dbname.



6
7
8
# File 'lib/table_saw/configuration.rb', line 6

def dbname
  @dbname
end

#formatObject

Returns the value of attribute format.



6
7
8
# File 'lib/table_saw/configuration.rb', line 6

def format
  @format
end

#hostObject

Returns the value of attribute host.



6
7
8
# File 'lib/table_saw/configuration.rb', line 6

def host
  @host
end

#manifestObject

Returns the value of attribute manifest.



6
7
8
# File 'lib/table_saw/configuration.rb', line 6

def manifest
  @manifest
end

#outputObject

Returns the value of attribute output.



6
7
8
# File 'lib/table_saw/configuration.rb', line 6

def output
  @output
end

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/table_saw/configuration.rb', line 6

def password
  @password
end

#portObject

Returns the value of attribute port.



6
7
8
# File 'lib/table_saw/configuration.rb', line 6

def port
  @port
end

#userObject

Returns the value of attribute user.



6
7
8
# File 'lib/table_saw/configuration.rb', line 6

def user
  @user
end

#variablesObject



22
23
24
# File 'lib/table_saw/configuration.rb', line 22

def variables
  @variables || {}
end

Instance Method Details

#connectionObject



8
9
10
# File 'lib/table_saw/configuration.rb', line 8

def connection
  { adapter: 'postgresql', database: dbname, host:, port:, username: user, password: }
end

#url=(value) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/table_saw/configuration.rb', line 12

def url=(value)
  URI.parse(value).tap do |uri|
    self.dbname = uri.path[1..]
    self.host = uri.host
    self.port = uri.port
    self.user = uri.user
    self.password = uri.password
  end
end