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.



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

def initialize
  @map = FunctionMap.new
end

Instance Attribute Details

#mapObject (readonly)

Returns the value of attribute map.



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

def map
  @map
end

Instance Method Details

#execute(met_fpath) ⇒ Object



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

def execute(met_fpath)
  sma_wd = Pathname.pwd
  CSV.foreach(met_fpath) do |csv_row|
    if 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
end