Class: LanguageServer::FileStore::FilePath
- Inherits:
-
Object
- Object
- LanguageServer::FileStore::FilePath
- Defined in:
- lib/language_server/file_store.rb
Instance Attribute Summary collapse
-
#local_path ⇒ Object
readonly
Returns the value of attribute local_path.
-
#local_root ⇒ Object
readonly
Returns the value of attribute local_root.
-
#remote_root ⇒ Object
readonly
Returns the value of attribute remote_root.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(remote_root:, local_root:, local_path:) ⇒ FilePath
constructor
A new instance of FilePath.
- #remote_path ⇒ Object
Constructor Details
#initialize(remote_root:, local_root:, local_path:) ⇒ FilePath
Returns a new instance of FilePath.
16 17 18 19 20 |
# File 'lib/language_server/file_store.rb', line 16 def initialize(remote_root:, local_root:, local_path:) @remote_root = remote_root @local_root = local_root @local_path = local_path end |
Instance Attribute Details
#local_path ⇒ Object (readonly)
Returns the value of attribute local_path.
14 15 16 |
# File 'lib/language_server/file_store.rb', line 14 def local_path @local_path end |
#local_root ⇒ Object (readonly)
Returns the value of attribute local_root.
14 15 16 |
# File 'lib/language_server/file_store.rb', line 14 def local_root @local_root end |
#remote_root ⇒ Object (readonly)
Returns the value of attribute remote_root.
14 15 16 |
# File 'lib/language_server/file_store.rb', line 14 def remote_root @remote_root end |
Class Method Details
.from_remote_uri(remote_root:, local_root:, remote_uri:) ⇒ Object
9 10 11 |
# File 'lib/language_server/file_store.rb', line 9 def from_remote_uri(remote_root:, local_root:, remote_uri:) new(remote_root: remote_root, local_root: local_root, local_path: URI(remote_uri).path.sub(remote_root, local_root)) end |
Instance Method Details
#==(other) ⇒ Object
30 31 32 |
# File 'lib/language_server/file_store.rb', line 30 def ==(other) eql?(other) end |
#eql?(other) ⇒ Boolean
26 27 28 |
# File 'lib/language_server/file_store.rb', line 26 def eql?(other) self.class == other.class && remote_path == other.remote_path end |
#hash ⇒ Object
34 35 36 |
# File 'lib/language_server/file_store.rb', line 34 def hash self.remote_path.hash end |
#remote_path ⇒ Object
22 23 24 |
# File 'lib/language_server/file_store.rb', line 22 def remote_path @remote_path ||= local_path.sub(local_root, remote_root) end |