Class: Delorean::SafeNavigationGetAttr

Inherits:
GetAttr
  • Object
show all
Defined in:
lib/delorean/nodes.rb

Instance Method Summary collapse

Methods inherited from GetAttr

#check

Instance Method Details

#rewrite(_context, vcode) ⇒ Object



399
400
401
402
403
# File 'lib/delorean/nodes.rb', line 399

def rewrite(_context, vcode)
  attr = i.text_value
  attr = "'#{attr}'" unless /\A[0-9]+\z/.match?(attr)
  "_safe_navigation_get_attr(#{vcode}, #{attr}, _e)"
end