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.



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

def initialize workspace = nil
  @workspace = workspace
  include_globs = ['**/*.rb']
  exclude_globs = ['spec/**/*', 'test/**/*']
  unless @workspace.nil?
    sfile = File.join(@workspace, '.solargraph.yml')
    if File.file?(sfile)
      @raw_data = YAML.load(File.read(sfile))
    end
  end
  @raw_data ||= {}
  @raw_data['include'] = @raw_data['include'] || include_globs
  @raw_data['exclude'] = @raw_data['exclude'] || exclude_globs
  @raw_data['extensions'] = @raw_data['extensions'] || []
end

Instance Attribute Details

#raw_dataObject (readonly)

Returns the value of attribute raw_data.



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

def raw_data
  @raw_data
end

#workspaceObject (readonly)

Returns the value of attribute workspace.



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

def workspace
  @workspace
end

Instance Method Details

#excludedObject



29
30
31
# File 'lib/solargraph/api_map/config.rb', line 29

def excluded
  process_globs @raw_data['exclude']
end

#extensionsObject



33
34
35
# File 'lib/solargraph/api_map/config.rb', line 33

def extensions
  @raw_data['extensions']
end

#includedObject



25
26
27
# File 'lib/solargraph/api_map/config.rb', line 25

def included
  process_globs @raw_data['include']
end