Module: RedParse::FlattenedIvars

Included in:
Node, VarNameToken, VarNode
Defined in:
lib/redparse/node.rb

Constant Summary collapse

EXCLUDED_IVARS =
%w[@data @offset @startline @endline]

Instance Method Summary collapse

Instance Method Details

#flattened_ivarsObject

EXCLUDED_IVARS.push(*EXCLUDED_IVARS.map{|iv| iv.to_sym })



45
46
47
48
49
50
51
52
53
# File 'lib/redparse/node.rb', line 45

def flattened_ivars
  ivars=instance_variables.map{|v| v.to_s }
  ivars-=EXCLUDED_IVARS
  ivars.sort!
  result=ivars+ivars.map{|iv| 
    instance_variable_get(iv)
  }
  return result
end

#flattened_ivars_equal?(other) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
58
# File 'lib/redparse/node.rb', line 55

def flattened_ivars_equal?(other)
  self.class == other.class and
    flattened_ivars == other.flattened_ivars
end