Method: CShadow#each_attr_value

Defined in:
lib/cgen/cshadow.rb

#each_attr_valueObject

Iterate over each shadow attr and instance var of self, yielding the attr name and value in this instance to the block. Differs in three ways from CShadow.each_shadow_attr: it is an instance method of shadow objects, it iterates over both shadow attrs and instance vars, and it yields both the name and the value. (In the case of instance vars, the name does not include the “@”.)



1069
1070
1071
1072
1073
1074
1075
1076
1077
# File 'lib/cgen/cshadow.rb', line 1069

def each_attr_value # :yields: attr_name, attr_value
  values = _dump_data
  self.class.shadow_attrs.each_with_index do |attr, i|
    yield attr.var.to_s, values[i]
  end
  instance_variables.each do |ivar|
    yield ivar[1..-1], instance_variable_get(ivar)
  end
end