Class: Appstats::Context
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Appstats::Context
- Defined in:
- lib/appstats/context.rb
Instance Method Summary collapse
Instance Method Details
#context_value=(value) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/appstats/context.rb', line 8 def context_value=(value) self[:context_value] = value self[:context_int] = nil self[:context_float] = nil return if value.nil? as_int = value.to_i as_float = value.to_f self[:context_int] = as_int if as_int.to_s == value self[:context_float] = as_float if as_float.to_s == value || !self[:context_int].nil? end |
#to_s ⇒ Object
19 20 21 22 23 |
# File 'lib/appstats/context.rb', line 19 def to_s return "No Context" if context_key.nil? || context_key == '' "#{context_key}[]" if context_value.nil? "#{context_key}[#{context_value}]" end |