Class: MetricFu::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/metric_fu/metrics/hotspots/analysis/record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, _columns) ⇒ Record

Returns a new instance of Record.



5
6
7
# File 'lib/metric_fu/metrics/hotspots/analysis/record.rb', line 5

def initialize(data, _columns)
  @data = data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/metric_fu/metrics/hotspots/analysis/record.rb', line 9

def method_missing(name, *args, &block)
  key = name.to_s
  if key == "fetch"
    @data.send(name, *args, &block)
  elsif @data.has_key?(key)
    @data[key]
  else
    super(name, *args, &block)
  end
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/metric_fu/metrics/hotspots/analysis/record.rb', line 3

def data
  @data
end

Instance Method Details

#[](key) ⇒ Object



24
25
26
# File 'lib/metric_fu/metrics/hotspots/analysis/record.rb', line 24

def [](key)
  @data[key]
end

#[]=(key, value) ⇒ Object



20
21
22
# File 'lib/metric_fu/metrics/hotspots/analysis/record.rb', line 20

def []=(key, value)
  @data[key] = value
end

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/metric_fu/metrics/hotspots/analysis/record.rb', line 28

def has_key?(key)
  @data.has_key?(key)
end