Class: Record
- Inherits:
-
Object
show all
- Defined in:
- lib/base/metric_analyzer.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(data, columns) ⇒ Record
Returns a new instance of Record.
330
331
332
333
|
# File 'lib/base/metric_analyzer.rb', line 330
def initialize(data, columns)
@data = data
@columns = columns
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
335
336
337
338
339
340
341
342
343
344
|
# File 'lib/base/metric_analyzer.rb', line 335
def method_missing(name, *args, &block)
key = name.to_s
if @data.has_key?(key)
@data[key]
elsif @columns.member?(key)
nil
else
super(name, *args, &block)
end
end
|
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
328
329
330
|
# File 'lib/base/metric_analyzer.rb', line 328
def data
@data
end
|
Instance Method Details
#[](key) ⇒ Object
350
351
352
|
# File 'lib/base/metric_analyzer.rb', line 350
def [](key)
@data[key]
end
|
#[]=(key, value) ⇒ Object
346
347
348
|
# File 'lib/base/metric_analyzer.rb', line 346
def []=(key, value)
@data[key]=value
end
|
#attributes ⇒ Object
362
363
364
|
# File 'lib/base/metric_analyzer.rb', line 362
def attributes
@columns
end
|
#has_key?(key) ⇒ Boolean
358
359
360
|
# File 'lib/base/metric_analyzer.rb', line 358
def has_key?(key)
@data.has_key?(key)
end
|
#keys ⇒ Object
354
355
356
|
# File 'lib/base/metric_analyzer.rb', line 354
def keys
@data.keys
end
|