Sha256: 266fa5e71db7860ac4c8e2645747fe1ecbc0640aa94b28724a9a4986221b8aef

Contents?: true

Size: 691 Bytes

Versions: 10

Compression:

Stored size: 691 Bytes

Contents

module Rack
  class MiniProfiler
    module TimerStruct
      # A base class for timing structures
      class Base

        def initialize(attrs={})
          @attributes = attrs
        end

        def attributes
          @attributes ||= {}
        end

        def [](name)
          attributes[name]
        end

        def []=(name, val)
          attributes[name] = val
          self
        end

        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

      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rack-mini-profiler-0.10.1 lib/mini_profiler/timer_struct/base.rb
rack-mini-profiler-0.9.9.2 lib/mini_profiler/timer_struct/base.rb
rack-mini-profiler-0.9.9.1 lib/mini_profiler/timer_struct/base.rb
rack-mini-profiler-0.9.9 lib/mini_profiler/timer_struct/base.rb
rack-mini-profiler-0.9.8 lib/mini_profiler/timer_struct/base.rb
rack-mini-profiler-0.9.7 lib/mini_profiler/timer_struct/base.rb
rack-mini-profiler-0.9.6 lib/mini_profiler/timer_struct/base.rb
rack-mini-profiler-0.9.5 lib/mini_profiler/timer_struct/base.rb
rack-mini-profiler-0.9.4 lib/mini_profiler/timer_struct/base.rb
rack-mini-profiler-0.9.3 lib/mini_profiler/timer_struct/base.rb