Last active
August 29, 2015 14:04
-
-
Save emersonmoura/c4d9dcd02ea9e38760a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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