Class: MeterCat::Config
- Inherits:
-
Object
- Object
- MeterCat::Config
- Includes:
- Singleton
- Defined in:
- lib/meter_cat/config.rb
Constant Summary collapse
- NIL_PROC =
proc {}
Instance Attribute Summary collapse
-
#calculator ⇒ Object
Returns the value of attribute calculator.
-
#expiration ⇒ Object
Returns the value of attribute expiration.
-
#from ⇒ Object
Returns the value of attribute from.
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#mail_days ⇒ Object
Returns the value of attribute mail_days.
-
#mail_names ⇒ Object
Returns the value of attribute mail_names.
-
#retry_attempts ⇒ Object
Returns the value of attribute retry_attempts.
-
#retry_delay ⇒ Object
Returns the value of attribute retry_delay.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #authenticate_with(&blk) ⇒ Object
- #authorize_with(&block) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #percentage(name, numerator, denominator) ⇒ Object
- #ratio(name, numerator, denominator) ⇒ Object
- #sum(name, values) ⇒ Object
Constructor Details
#initialize ⇒ Config
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
#calculator ⇒ Object
Returns the value of attribute calculator.
10 11 12 |
# File 'lib/meter_cat/config.rb', line 10 def calculator @calculator end |
#expiration ⇒ Object
Returns the value of attribute expiration.
10 11 12 |
# File 'lib/meter_cat/config.rb', line 10 def expiration @expiration end |
#from ⇒ Object
Returns the value of attribute from.
11 12 13 |
# File 'lib/meter_cat/config.rb', line 11 def from @from end |
#layout ⇒ Object
Returns the value of attribute layout.
12 13 14 |
# File 'lib/meter_cat/config.rb', line 12 def layout @layout end |
#mail_days ⇒ Object
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_names ⇒ Object
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_attempts ⇒ Object
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_delay ⇒ Object
Returns the value of attribute retry_delay.
10 11 12 |
# File 'lib/meter_cat/config.rb', line 10 def retry_delay @retry_delay end |
#subject ⇒ Object
Returns the value of attribute subject.
11 12 13 |
# File 'lib/meter_cat/config.rb', line 11 def subject @subject end |
#to ⇒ Object
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 (&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 |