Class: Solargraph::ApiMap::Config
- Inherits:
-
Object
- Object
- Solargraph::ApiMap::Config
- Defined in:
- lib/solargraph/api_map/config.rb
Instance Attribute Summary collapse
- #domains ⇒ Array<String> readonly
- #excluded ⇒ Array<String> readonly
- #included ⇒ Array<String> readonly
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
- #workspace ⇒ String readonly
Instance Method Summary collapse
-
#initialize(workspace = nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(workspace = nil) ⇒ Config
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/solargraph/api_map/config.rb', line 19 def initialize workspace = nil @workspace = workspace include_globs = ['**/*.rb'] exclude_globs = ['spec/**/*', 'test/**/*'] @included = [] @excluded = [] @domains = [] unless @workspace.nil? include_globs = ['**/*.rb'] exclude_globs = ['spec/**/*', 'test/**/*'] sfile = File.join(@workspace, '.solargraph.yml') if File.file?(sfile) @raw_data = YAML.load(File.read(sfile)) conf = YAML.load(File.read(sfile)) include_globs = conf['include'] || include_globs exclude_globs = conf['exclude'] || [] @domains = conf['domains'] || [] end @included.concat process_globs(include_globs) @excluded.concat process_globs(exclude_globs) end @raw_data ||= {} @raw_data['include'] = @raw_data['include'] || include_globs @raw_data['exclude'] = @raw_data['exclude'] || exclude_globs # @todo If the domains config goes stable, add it to @raw_data end |
Instance Attribute Details
#domains ⇒ Array<String> (readonly)
17 18 19 |
# File 'lib/solargraph/api_map/config.rb', line 17 def domains @domains end |
#excluded ⇒ Array<String> (readonly)
14 15 16 |
# File 'lib/solargraph/api_map/config.rb', line 14 def excluded @excluded end |
#included ⇒ Array<String> (readonly)
11 12 13 |
# File 'lib/solargraph/api_map/config.rb', line 11 def included @included end |
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
8 9 10 |
# File 'lib/solargraph/api_map/config.rb', line 8 def raw_data @raw_data end |
#workspace ⇒ String (readonly)
7 8 9 |
# File 'lib/solargraph/api_map/config.rb', line 7 def workspace @workspace end |