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.



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

def dbname
  @dbname
end

#formatObject

Returns the value of attribute format.



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

def format
  @format
end

#hostObject

Returns the value of attribute host.



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

def host
  @host
end

#manifestObject

Returns the value of attribute manifest.



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

def manifest
  @manifest
end

#outputObject

Returns the value of attribute output.



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

def output
  @output
end

#passwordObject

Returns the value of attribute password.



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

def password
  @password
end

#portObject

Returns the value of attribute port.



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

def port
  @port
end

#userObject

Returns the value of attribute user.



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

def user
  @user
end

#variablesObject



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

def variables
  @variables || {}
end

Instance Method Details

#connectionObject



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

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

#url=(value) ⇒ Object



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

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