Module: React::Component::DslInstanceMethods

Defined in:
lib/hyper_trace/react_trace.rb

Instance Method Summary collapse

Instance Method Details

#hypertrace_format_instance(h) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/hyper_trace/react_trace.rb', line 21

def hypertrace_format_instance(h)
  filtered_vars =
    instance_variables -
    ['@native', '@props_wrapper', '@state_wrapper', '@waiting_on_resources']
  h.format_instance(self, filtered_vars) do
    @props_wrapper.props.each do |param, value|
      val = h.safe_i value
      h.group("params.#{param}: #{val[0..10]}", collapsed: true) do
        puts val
        h.log value
      end
    end if @props_wrapper
    hash = Hash.new(`#{@native}.state`)
    updated_at = hash.delete('***_state_updated_at-***')
    h.group("state last updated at: #{Time.at(updated_at)}") if updated_at
    hash.each do |state, value|
      val = h.safe_i(value)
      h.group("state.#{state}: #{val[0..10]}", collapsed: true) do
        puts val
        h.log value
      end
    end
  end
end