Module: SyntaxTree::LanguageServer::Request

Defined in:
lib/syntax_tree/language_server.rb

Overview

This is a small module that effectively mirrors pattern matching. We’re using it so that we can support truffleruby without having to ignore the language server.

Defined Under Namespace

Classes: Shape, Tuple

Class Method Summary collapse

Class Method Details

.[](value) ⇒ Object



203
204
205
206
207
208
209
210
211
212
# File 'lib/syntax_tree/language_server.rb', line 203

def self.[](value)
  case value
  when Array
    Tuple.new(value.map { |child| self[child] })
  when Hash
    Shape.new(value.transform_values { |child| self[child] })
  else
    value
  end
end