class RorVsWild::Section

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/rorvswild/section.rbs

class RorVsWild::Section
  def sibling?: (RorVsWild::Section section) -> false
end

def self.current

def self.current
  (sections = stack) && sections.last
end

def self.stack

def self.stack
  (data = RorVsWild.agent.current_data) && data[:section_stack]
end

def self.start(&block)

def self.start(&block)
  section = Section.new
  block.call(section) if block_given?
  stack && stack.push(section)
  section
end

def self.stop(&block)

def self.stop(&block)
  return unless stack && section = stack.pop
  block.call(section) if block_given?
  section.total_runtime = RorVsWild.clock_milliseconds - section.started_at
  current.children_runtime += section.total_runtime if current
  RorVsWild.agent.add_section(section)
end

def command=(value)

def command=(value)
  @command = value && value.size > COMMAND_MAX_SIZE ? value[0, COMMAND_MAX_SIZE] + " [TRUNCATED]" : value
end

def initialize

def initialize
  @calls = 1
  @total_runtime = 0
  @children_runtime = 0
  @kind = "code".freeze
  @started_at = RorVsWild.clock_milliseconds
  location = RorVsWild.agent.locator.find_most_relevant_location(caller_locations)
  @file = RorVsWild.agent.locator.relative_path(location.path)
  @line = location.lineno
  @appendable_command = false
end

def merge(section)

def merge(section)
  self.calls += section.calls
  self.total_runtime += section.total_runtime
  self.children_runtime += section.children_runtime
  if section
    if appendable_command
      self.command = self.command.dup if self.command.frozen?
      self.command << "\n" + section.command
    end
  else
    self.command = section.command
  end
  self.appendable_command = appendable_command && section.appendable_command
end

def self_runtime

def self_runtime
  total_runtime - children_runtime
end

def sibling?(section)

Experimental RBS support (using type sampling data from the type_fusion project).

def sibling?: (RorVsWild::Section section) -> false

This signature was generated using 1 sample from 1 application.

def sibling?(section)
  kind == section.kind && line == section.line && file == section.file
end

def to_h

def to_h
  {calls: calls, total_runtime: total_runtime, children_runtime: children_runtime, kind: kind, started_at: started_at, file: file, line: line, command: command}
end

def to_json(options = {})

def to_json(options = {})
  to_h.to_json(options)
end