Class: MeterCat::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/meter_cat/config.rb

Constant Summary collapse

NIL_PROC =
proc {}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



14
15
16
17
18
19
# File 'lib/meter_cat/config.rb', line 14

def initialize
  @calculator = MeterCat::Calculator.new
  @expiration = Meter::DEFAULT_EXPIRATION
  @retry_attempts = Meter::DEFAULT_RETRY_ATTEMPTS
  @retry_delay = Meter::DEFAULT_RETRY_DELAY
end

Instance Attribute Details

#calculatorObject

Returns the value of attribute calculator.



10
11
12
# File 'lib/meter_cat/config.rb', line 10

def calculator
  @calculator
end

#expirationObject

Returns the value of attribute expiration.



10
11
12
# File 'lib/meter_cat/config.rb', line 10

def expiration
  @expiration
end

#fromObject

Returns the value of attribute from.



11
12
13
# File 'lib/meter_cat/config.rb', line 11

def from
  @from
end

#layoutObject

Returns the value of attribute layout.



12
13
14
# File 'lib/meter_cat/config.rb', line 12

def layout
  @layout
end

#mail_daysObject

Returns the value of attribute mail_days.



11
12
13
# File 'lib/meter_cat/config.rb', line 11

def mail_days
  @mail_days
end

#mail_namesObject

Returns the value of attribute mail_names.



11
12
13
# File 'lib/meter_cat/config.rb', line 11

def mail_names
  @mail_names
end

#retry_attemptsObject

Returns the value of attribute retry_attempts.



10
11
12
# File 'lib/meter_cat/config.rb', line 10

def retry_attempts
  @retry_attempts
end

#retry_delayObject

Returns the value of attribute retry_delay.



10
11
12
# File 'lib/meter_cat/config.rb', line 10

def retry_delay
  @retry_delay
end

#subjectObject

Returns the value of attribute subject.



11
12
13
# File 'lib/meter_cat/config.rb', line 11

def subject
  @subject
end

#toObject

Returns the value of attribute to.



11
12
13
# File 'lib/meter_cat/config.rb', line 11

def to
  @to
end

Instance Method Details

#authenticate_with(&blk) ⇒ Object



33
34
35
36
# File 'lib/meter_cat/config.rb', line 33

def authenticate_with(&blk)
  @authenticate = blk if blk
  @authenticate || NIL_PROC
end

#authorize_with(&block) ⇒ Object



38
39
40
41
# File 'lib/meter_cat/config.rb', line 38

def authorize_with(&block)
  @authorize = block if block
  @authorize || NIL_PROC
end

#percentage(name, numerator, denominator) ⇒ Object



25
26
27
# File 'lib/meter_cat/config.rb', line 25

def percentage(name, numerator, denominator)
  @calculator.percentage(name, numerator, denominator)
end

#ratio(name, numerator, denominator) ⇒ Object



21
22
23
# File 'lib/meter_cat/config.rb', line 21

def ratio(name, numerator, denominator)
  @calculator.ratio(name, numerator, denominator)
end

#sum(name, values) ⇒ Object



29
30
31
# File 'lib/meter_cat/config.rb', line 29

def sum(name, values)
  @calculator.sum(name, values)
end