Class: Nosey::Probe::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/nosey/probe.rb

Overview

Base class for containing key/value pairs in nosey. This class is responsible for reseting probes.

Direct Known Subclasses

Average, Count, Maximum, Minimum, Sum, Touch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, value = nil) ⇒ Base

Returns a new instance of Base.



9
10
11
# File 'lib/nosey/probe.rb', line 9

def initialize(name=nil, value=nil)
  @name, @value = name, value
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/nosey/probe.rb', line 6

def name
  @name
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/nosey/probe.rb', line 7

def value
  @value
end

Instance Method Details

#resetObject

Reset the value to nil



19
20
21
# File 'lib/nosey/probe.rb', line 19

def reset
  @value = nil
end

#set(value) ⇒ Object

Set the value (don’t increment or whateves)



14
15
16
# File 'lib/nosey/probe.rb', line 14

def set(value)
  @value = value
end

#to_hashObject

Representation of this probe



24
25
26
# File 'lib/nosey/probe.rb', line 24

def to_hash
  { name => value }
end