Class: Solargraph::ApiMap::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/solargraph/api_map/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workspace = nil) ⇒ Config

Returns a new instance of Config.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/solargraph/api_map/config.rb', line 8

def initialize workspace = nil
  @workspace = workspace
  @included = []
  @excluded = []
  include_globs = ['**/*.rb']
  exclude_globs = ['spec/**/*']
  unless @workspace.nil?
    sfile = File.join(@workspace, '.solargraph.yml')
    if File.file?(sfile)
      conf = YAML.load(File.read(sfile))
      include_globs = conf['include'] || include_globs
      exclude_globs = conf['exclude'] || []
    end
  end
  include_globs.each { |g| @included.concat process_glob(g) }
  exclude_globs.each { |g| @excluded.concat process_glob(g) }
end

Instance Attribute Details

#excludedObject (readonly)

Returns the value of attribute excluded.



6
7
8
# File 'lib/solargraph/api_map/config.rb', line 6

def excluded
  @excluded
end

#includedObject (readonly)

Returns the value of attribute included.



5
6
7
# File 'lib/solargraph/api_map/config.rb', line 5

def included
  @included
end

#workspaceObject (readonly)

Returns the value of attribute workspace.



4
5
6
# File 'lib/solargraph/api_map/config.rb', line 4

def workspace
  @workspace
end