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.



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

def dbname
  @dbname
end

#hostObject

Returns the value of attribute host.



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

def host
  @host
end

#manifestObject

Returns the value of attribute manifest.



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

def manifest
  @manifest
end

#outputObject

Returns the value of attribute output.



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

def output
  @output
end

#passwordObject

Returns the value of attribute password.



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

def password
  @password
end

#portObject

Returns the value of attribute port.



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

def port
  @port
end

#userObject

Returns the value of attribute user.



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

def user
  @user
end

Instance Method Details

#connectionObject



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

def connection
  { dbname: dbname, host: host, port: port, user: user, password: password }
end

#url=(value) ⇒ Object



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

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