Class: Solargraph::Mapper
- Inherits:
-
Object
- Object
- Solargraph::Mapper
- Defined in:
- lib/solargraph/mapper.rb
Instance Method Summary collapse
- #find_workspace(filename) ⇒ Object
- #get(filename, text) ⇒ Object
-
#initialize ⇒ Mapper
constructor
A new instance of Mapper.
Constructor Details
#initialize ⇒ Mapper
Returns a new instance of Mapper.
3 4 5 6 7 8 9 |
# File 'lib/solargraph/mapper.rb', line 3 def initialize @default_api_map = Solargraph::ApiMap.new stub = Parser::CurrentRuby.parse(Solargraph::LiveParser.parse(nil)) @default_api_map.merge(stub) @default_api_map.freeze @require_nodes = {} end |
Instance Method Details
#find_workspace(filename) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/solargraph/mapper.rb', line 16 def find_workspace filename dirname = filename lastname = nil result = nil until dirname == lastname if File.file?("#{dirname}/Gemfile") result = dirname break end lastname = dirname dirname = File.dirname(dirname) end result || File.dirname(filename) end |