Class: Delorean::GetAttr

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

Direct Known Subclasses

SafeNavigationGetAttr

Instance Method Summary collapse

Instance Method Details

#check(_context) ⇒ Object



387
388
389
# File 'lib/delorean/nodes.rb', line 387

def check(_context, *)
  []
end

#rewrite(_context, vcode) ⇒ Object



391
392
393
394
395
# File 'lib/delorean/nodes.rb', line 391

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