Module: Solargraph::Arc::Util
- Defined in:
- lib/solargraph/arc/util.rb
Class Method Summary collapse
- .build_location(ast, path) ⇒ Object
- .build_module_extend(ns, module_name, location) ⇒ Object
- .build_module_include(ns, module_name, location) ⇒ Object
- .build_public_method(ns, name, types: nil, location: nil, attribute: false, scope: :instance) ⇒ Object
- .dummy_location(path) ⇒ Object
- .method_return(path, type) ⇒ Object
Class Method Details
.build_location(ast, path) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# 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) ⇒ Object
29 30 31 32 33 34 35 |
# 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) ⇒ Object
21 22 23 24 25 26 27 |
# 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) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# 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) ⇒ Object
37 38 39 40 41 42 |
# 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) ⇒ Object
56 57 58 |
# File 'lib/solargraph/arc/util.rb', line 56 def self.method_return(path, type) Solargraph::Pin::Reference::Override.method_return(path, type) end |