class Rack::WebProfiler::Collector::DataStorage
Used to store datas who Collector
needs.
@todo do DataStorage
compatible with Marshal
Attributes
datas[R]
Public Class Methods
new()
click to toggle source
# File lib/rack/web_profiler/collector.rb, line 110 def initialize @datas = Hash.new @status = nil @show_tab = true @show_panel = true end
Public Instance Methods
show_panel(b = nil)
click to toggle source
@param b [Boolean, nil]
@return [Boolean]
# File lib/rack/web_profiler/collector.rb, line 143 def show_panel(b = nil) @show_panel = !!b unless b.nil? @show_panel end
show_tab(b = nil)
click to toggle source
@param b [Boolean, nil]
@return [Boolean]
# File lib/rack/web_profiler/collector.rb, line 153 def show_tab(b = nil) @show_tab = !!b unless b.nil? @show_tab end
status(v = nil)
click to toggle source
Status.
@param v [Symbol, nil]
@return [Symbol, nil]
# File lib/rack/web_profiler/collector.rb, line 131 def status(v = nil) # @todo check status? # raise Exception, "" unless [:success, :warning, :danger].include?(v) @status = v.to_sym unless v.nil? @status end
store(k, v)
click to toggle source
Store a value.
@param k [String, Symbol] @param v
# File lib/rack/web_profiler/collector.rb, line 121 def store(k, v) # @todo check data format (must be compatible with Marshal) @datas[k.to_sym] = v end
to_h()
click to toggle source
Transform DataStorage
to an Hash
@return [Hash<Symbol, Object>]
# File lib/rack/web_profiler/collector.rb, line 161 def to_h { datas: @datas, status: @status, show_panel: @show_panel, show_tab: @show_tab, } end