Class: AdLint::Ld::TypedefMapper

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTypedefMapper

Returns a new instance of TypedefMapper.



85
86
87
# File 'lib/adlint/ld/typedef.rb', line 85

def initialize
  @map = TypedefMap.new
end

Instance Attribute Details

#mapObject (readonly)

Returns the value of attribute map.



89
90
91
# File 'lib/adlint/ld/typedef.rb', line 89

def map
  @map
end

Instance Method Details

#execute(met_fpath) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/adlint/ld/typedef.rb', line 91

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.typedef_declaration?
        @map.add(Typedef.new(rec.type_name, rec.location))
      end
    end
  end
end