Skip to content

Instantly share code, notes, and snippets.

@emersonmoura
Last active August 29, 2015 14:04
Show Gist options
  • Save emersonmoura/c4d9dcd02ea9e38760a5 to your computer and use it in GitHub Desktop.
Save emersonmoura/c4d9dcd02ea9e38760a5 to your computer and use it in GitHub Desktop.
class PoolInformation
attr_reader :dataSource
def initialize(informations = {})
@config = ConfigReader.new
define_attr informations
end
def label
@dataSource.upcase
end
def information
["#{label}_TOTAL.value #{@totalCreatedConnections}","#{label}_AVAILABLE.value #{@totalFree}","#{label}_USED.value #{@totalLeased}"]
end
def information_config
@config.file['information_value'] % { label: label, color: colors[label] }
end
private
def colors
@config.colors
end
def define_attr(informations = {})
@dataSource = informations['dataSource']
@connectionsRequested = informations['connectionsRequested']
@statementsExecuted = informations['statementsExecuted']
@statementsPrepared = informations['statementsPrepared']
@totalCreatedConnections = informations['totalCreatedConnections']
@totalFree = informations['totalFree']
@totalLeased = informations['totalLeased']
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment