class Rack::MiniProfiler::TimerStruct::Base

A base class for timing structures

Public Class Methods

new(attrs = {}) click to toggle source
# File lib/mini_profiler/timer_struct/base.rb, line 11
def initialize(attrs = {})
  @attributes = attrs
end

Public Instance Methods

[](name) click to toggle source
# File lib/mini_profiler/timer_struct/base.rb, line 19
def [](name)
  attributes[name]
end
[]=(name, val) click to toggle source
# File lib/mini_profiler/timer_struct/base.rb, line 23
def []=(name, val)
  attributes[name] = val
  self
end
as_json(options = nil) click to toggle source
# File lib/mini_profiler/timer_struct/base.rb, line 34
def as_json(options = nil)
  @attributes.as_json(options)
end
attributes() click to toggle source
# File lib/mini_profiler/timer_struct/base.rb, line 15
def attributes
  @attributes ||= {}
end
to_json(*a) click to toggle source
# File lib/mini_profiler/timer_struct/base.rb, line 28
def to_json(*a)
  # this does could take in an option hash, but the only interesting there is max_nesting.
  #   if this becomes an option we could increase
  ::JSON.generate(@attributes, max_nesting: 100)
end