module Solargraph::Arc::Util

Public Class Methods

build_location(ast, path) click to toggle source
# File lib/solargraph/arc/util.rb, line 44
def self.build_location(ast, path)
  Solargraph::Location.new(
    path,
    Solargraph::Range.from_to(
      ast.location.first_line,
      0,
      ast.location.last_line,
      ast.location.column
    )
  )
end
build_module_extend(ns, module_name, location) click to toggle source
# File lib/solargraph/arc/util.rb, line 29
def self.build_module_extend(ns, module_name, location)
  Solargraph::Pin::Reference::Extend.new(
    closure:  ns,
    name:     module_name,
    location: location
  )
end
build_module_include(ns, module_name, location) click to toggle source
# File lib/solargraph/arc/util.rb, line 21
def self.build_module_include(ns, module_name, location)
  Solargraph::Pin::Reference::Include.new(
    closure:  ns,
    name:     module_name,
    location: location
  )
end
build_public_method(ns, name, types: nil, location: nil, attribute: false, scope: :instance) click to toggle source
# File lib/solargraph/arc/util.rb, line 4
def self.build_public_method(ns, name, types: nil, location: nil, attribute: false, scope: :instance)
  opts = {
    name:      name,
    location:  location,
    closure:   ns,
    scope:     scope,
    attribute: attribute
  }

  comments = []
  comments << "@return [#{types.join(',')}]" if types

  opts[:comments] = comments.join("\n")

  Solargraph::Pin::Method.new(**opts)
end
dummy_location(path) click to toggle source
# File lib/solargraph/arc/util.rb, line 37
def self.dummy_location(path)
  Solargraph::Location.new(
    path,
    Solargraph::Range.from_to(0, 0, 0, 0)
  )
end
method_return(path, type) click to toggle source
# File lib/solargraph/arc/util.rb, line 56
def self.method_return(path, type)
  Solargraph::Pin::Reference::Override.method_return(path, type)
end