Class: Custodian::Samplers::Sampler

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/custodian/samplers/sampler.rb

Overview

Base class for samplers.

Direct Known Subclasses

CPU, Load, RAM, Who

Class Method Summary collapse

Methods included from Utilities

directory_exists?, file_exists?, program_exists?

Class Method Details

.compatible?Boolean

Determine whether the sampler is compatible with this system.

Returns true if it is compatible, or false if it isn’t.

Returns:

  • (Boolean)


39
40
41
# File 'lib/custodian/samplers/sampler.rb', line 39

def compatible?
  true
end

.describe(description) ⇒ Object

Describe the sampler.

description - A String describing the sampler.

Returns nothing.



15
16
17
# File 'lib/custodian/samplers/sampler.rb', line 15

def describe(description)
  @description = description
end

.descriptionObject

Returns the sampler’s description.



20
21
22
# File 'lib/custodian/samplers/sampler.rb', line 20

def description
  @description
end

.sampleObject

Make a sample from this sampler.

Examples

CPU.sample # => { "User" => "10%", "System" => "5%", "Idle" => "85%" }

Returns an Integer, Symbol, String, Hash or Array (or any combination thereof) describing the outcome of the sample.



32
33
34
# File 'lib/custodian/samplers/sampler.rb', line 32

def sample
  nil
end