Class: AdLint::Ld::VariableMapper

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeVariableMapper

Returns a new instance of VariableMapper.



144
145
146
# File 'lib/adlint/ld/object.rb', line 144

def initialize
  @map = VariableMap.new
end

Instance Attribute Details

#mapObject (readonly)

Returns the value of attribute map.



148
149
150
# File 'lib/adlint/ld/object.rb', line 148

def map
  @map
end

Instance Method Details

#execute(met_fpath) ⇒ Object



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/adlint/ld/object.rb', line 150

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.variable_definition?
        if rec.variable_linkage_type == "X"
          @map.add_variable(Variable.new(rec))
        end
      when rec.global_variable_declaration?
        @map.add_variable_declaration(VariableDeclaration.new(rec))
      end
    end
  end
end