Class: Ccp::Receivers::Profileable::Profile

Inherits:
Struct
  • Object
show all
Defined in:
lib/ccp/receivers/profileable.rb,
lib/ccp/receivers/profileable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#methodObject

Returns the value of attribute method

Returns:

  • (Object)

    the current value of method



6
7
8
# File 'lib/ccp/receivers/profileable.rb', line 6

def method
  @method
end

#targetObject

Returns the value of attribute target

Returns:

  • (Object)

    the current value of target



6
7
8
# File 'lib/ccp/receivers/profileable.rb', line 6

def target
  @target
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



6
7
8
# File 'lib/ccp/receivers/profileable.rb', line 6

def time
  @time
end

Instance Method Details

#nameObject



8
9
10
# File 'lib/ccp/receivers/profileable.rb', line 8

def name
  target.is_a?(Class) ? "#{target.name}.#{method}" : "#{target.class}##{method}"
end

#profile(total) ⇒ Object



12
13
14
# File 'lib/ccp/receivers/profileable.rb', line 12

def profile(total)
  "[%4.1f%%] %.7f %s" % [(time*100/total), time, name]
end