Class: Moped::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/peek/views/moped.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.command_countObject

Returns the value of attribute command_count.



6
7
8
# File 'lib/peek/views/moped.rb', line 6

def command_count
  @command_count
end

.command_operationsObject

Returns the value of attribute command_operations.



6
7
8
# File 'lib/peek/views/moped.rb', line 6

def command_operations
  @command_operations
end

.command_timeObject

Returns the value of attribute command_time.



6
7
8
# File 'lib/peek/views/moped.rb', line 6

def command_time
  @command_time
end

Instance Method Details

#logging_with_peek(*args, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/peek/views/moped.rb', line 12

def logging_with_peek(*args, &block)
  start = Time.now
  logging_without_peek(*args, &block)
ensure
  duration = (Time.now - start)
  Moped::Node.command_time.update { |value| value + duration }
  Moped::Node.command_count.update { |value| value + 1 }
  Moped::Node.command_operations.update { |value| value << [Moped::Node.command_count.get, duration, args[0], peek_app_backtrace] }
end

#peek_app_backtraceObject



23
24
25
26
# File 'lib/peek/views/moped.rb', line 23

def peek_app_backtrace
  root_path = Rails.root.to_s
  caller.grep(%r{^#{root_path}/(app|lib)}) { |v| v.sub(root_path, '') }
end