Class: Fast::PrismAdapter::Node

Inherits:
Node
  • Object
show all
Defined in:
lib/fast/prism_adapter.rb

Instance Attribute Summary

Attributes inherited from Node

#children, #loc, #type

Instance Method Summary collapse

Methods inherited from Node

#<<, #==, #author, #blame_authors, #buffer_name, #capture, #deconstruct, #each_child_node, #each_descendant, #expression, #file, #from_file?, #git, #git_blob, #git_log, #hash, #inspect, #last_commit, #line_range, #lines, #lines_of_code, #link, #location, #md_link, #md_link_description, #method_missing, #parent, parent_for, #permalink, #project_url, #remote_url, #respond_to_missing?, #root?, #search, set_parent, #sha, #source, #to_a, #to_ast, #to_s, #to_sexp

Constructor Details

#initialize(type, children:, loc:) ⇒ Node

Returns a new instance of Node.



61
62
63
# File 'lib/fast/prism_adapter.rb', line 61

def initialize(type, children:, loc:)
  super(type, Array(children), location: loc)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Fast::Node

Instance Method Details

#updated(type = nil, children = nil, properties = nil) ⇒ Object



65
66
67
68
69
70
71
# File 'lib/fast/prism_adapter.rb', line 65

def updated(type = nil, children = nil, properties = nil)
  self.class.new(
    type || self.type,
    children: children || self.children,
    loc: properties&.fetch(:location, loc) || loc
  )
end