Module: Solargraph::Convention

Defined in:
lib/solargraph/convention.rb,
lib/solargraph/convention/base.rb,
lib/solargraph/convention/gemfile.rb,
lib/solargraph/convention/gemspec.rb,
lib/solargraph/convention/rakefile.rb

Overview

Conventions provide a way to modify an ApiMap based on expectations about one of its sources.

Defined Under Namespace

Classes: Base, Gemfile, Gemspec, Rakefile

Constant Summary collapse

@@conventions =
Set.new

Class Method Summary collapse

Class Method Details

.for_global(object) ⇒ Environ

TODO:

Determine what argument needs to be passed here

Parameters:

  • object (Object)

Returns:



42
43
44
45
46
47
48
# File 'lib/solargraph/convention.rb', line 42

def self.for_global object
  result = Environ.new
  @@conventions.each do |conv|
    result.merge conv.global(object)
  end
  result
end

.for_local(source_map) ⇒ Environ

Parameters:

Returns:



30
31
32
33
34
35
36
# File 'lib/solargraph/convention.rb', line 30

def self.for_local source_map
  result = Environ.new
  @@conventions.each do |conv|
    result.merge conv.local(source_map)
  end
  result
end

.for_object(api_map, rooted_tag, scope, visibility, deep, skip, no_core) ⇒ Environ

Provides any additional method pins based on the described object.

Parameters:

  • api_map (ApiMap)
  • rooted_tag (String) —

    A fully qualified namespace, with generic parameter values if applicable

  • scope (Symbol) —

    :class or :instance

  • visibility (Array<Symbol>) —

    :public, :protected, and/or :private

  • deep (Boolean)
  • skip (Set<String>)
  • no_core (Boolean) —

    Skip core classes if true

Returns:



62
63
64
65
66
67
68
69
70
# File 'lib/solargraph/convention.rb', line 62

def self.for_object api_map, rooted_tag, scope, visibility,
                    deep, skip, no_core
  result = Environ.new
  @@conventions.each do |conv|
    result.merge conv.object(api_map, rooted_tag, scope, visibility,
                             deep, skip, no_core)
  end
  result
end

.register(convention) ⇒ void

This method returns an undefined value.

Parameters:



18
19
20
# File 'lib/solargraph/convention.rb', line 18

def self.register convention
  @@conventions.add convention.new
end

.unregister(convention) ⇒ void

This method returns an undefined value.

Parameters:



24
25
26
# File 'lib/solargraph/convention.rb', line 24

def self.unregister convention
  @@conventions.delete_if { |c| c.is_a?(convention) }
end