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,
lib/solargraph/convention/data_definition.rb,
lib/solargraph/convention/struct_definition.rb,
lib/solargraph/convention/active_support_concern.rb,
lib/solargraph/convention/data_definition/data_assignment_node.rb,
lib/solargraph/convention/data_definition/data_definition_node.rb,
lib/solargraph/convention/struct_definition/struct_assignment_node.rb,
lib/solargraph/convention/struct_definition/struct_definition_node.rb

Overview

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

Defined Under Namespace

Modules: DataDefinition, StructDefinition Classes: ActiveSupportConcern, Base, Gemfile, Gemspec, Rakefile

Constant Summary collapse

@@conventions =
Set.new

Class Method Summary collapse

Class Method Details

.for_global(doc_map) ⇒ Environ

Parameters:

Returns:



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

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

.for_local(source_map) ⇒ Environ

Parameters:

Returns:



33
34
35
36
37
38
39
# File 'lib/solargraph/convention.rb', line 33

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:



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

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:



21
22
23
# File 'lib/solargraph/convention.rb', line 21

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

.unregister(convention) ⇒ void

This method returns an undefined value.

Parameters:



27
28
29
# File 'lib/solargraph/convention.rb', line 27

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