Class: AdLint::Ld::FunctionMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/adlint/ld/object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFunctionMapper

Returns a new instance of FunctionMapper.



302
303
304
# File 'lib/adlint/ld/object.rb', line 302

def initialize
  @map = FunctionMap.new
end

Instance Attribute Details

#mapObject (readonly)

Returns the value of attribute map.



306
307
308
# File 'lib/adlint/ld/object.rb', line 306

def map
  @map
end

Instance Method Details

#execute(met_fpath) ⇒ Object



308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/adlint/ld/object.rb', line 308

def execute(met_fpath)
  sma_wd = Pathname.pwd
  CSV.foreach(met_fpath) do |csv_row|
    rec = MetricRecord.of(csv_row, sma_wd)
    case
    when rec.version?
      sma_wd = Pathname.new(rec.exec_working_directory)
    when rec.function_definition?
      @map.add_function(Function.new(rec))
    when rec.function_declaration?
      @map.add_function_declaration(FunctionDeclaration.new(rec))
    end
  end
end