Class: Yoda::Server::RootlessWorkspace
- Inherits:
-
Object
- Object
- Yoda::Server::RootlessWorkspace
- Defined in:
- lib/yoda/server/rootless_workspace.rb
Instance Attribute Summary collapse
- #name ⇒ String readonly
Instance Method Summary collapse
- #file_tree ⇒ Store::FileTree
-
#initialize(name:) ⇒ RootlessWorkspace
constructor
A new instance of RootlessWorkspace.
- #project ⇒ Store::Project?
- #read_at(uri) ⇒ String?
- #read_source(uri) ⇒ Object
- #setup ⇒ Object
- #store_source(uri:, source:) ⇒ Object
- #subpath?(path) ⇒ Boolean
- #suburi?(uri) ⇒ Boolean
- #uri_of_path(path) ⇒ Object
Constructor Details
#initialize(name:) ⇒ RootlessWorkspace
Returns a new instance of RootlessWorkspace.
10 11 12 |
# File 'lib/yoda/server/rootless_workspace.rb', line 10 def initialize(name:) @name = name end |
Instance Attribute Details
#name ⇒ String (readonly)
7 8 9 |
# File 'lib/yoda/server/rootless_workspace.rb', line 7 def name @name end |
Instance Method Details
#file_tree ⇒ Store::FileTree
57 58 59 |
# File 'lib/yoda/server/rootless_workspace.rb', line 57 def file_tree project.file_tree end |
#project ⇒ Store::Project?
19 20 21 |
# File 'lib/yoda/server/rootless_workspace.rb', line 19 def project @project ||= Store::Project.temporal(name: name) end |
#read_at(uri) ⇒ String?
30 31 32 33 |
# File 'lib/yoda/server/rootless_workspace.rb', line 30 def read_at(uri) path = UriDecoder.path_of_uri(uri) path && file_tree.read_at(path) end |
#read_source(uri) ⇒ Object
36 37 38 39 |
# File 'lib/yoda/server/rootless_workspace.rb', line 36 def read_source(uri) path = UriDecoder.path_of_uri(uri) file_tree.clear_editing_at(path) end |
#setup ⇒ Object
14 15 16 |
# File 'lib/yoda/server/rootless_workspace.rb', line 14 def setup project.setup end |
#store_source(uri:, source:) ⇒ Object
43 44 45 46 |
# File 'lib/yoda/server/rootless_workspace.rb', line 43 def store_source(uri:, source:) path = UriDecoder.path_of_uri(uri) file_tree.set_editing_at(path, source) end |
#subpath?(path) ⇒ Boolean
52 53 54 |
# File 'lib/yoda/server/rootless_workspace.rb', line 52 def subpath?(path) true end |
#suburi?(uri) ⇒ Boolean
48 49 50 |
# File 'lib/yoda/server/rootless_workspace.rb', line 48 def suburi?(uri) true end |
#uri_of_path(path) ⇒ Object
24 25 26 |
# File 'lib/yoda/server/rootless_workspace.rb', line 24 def uri_of_path(path) FileStore.uri_of_path(File.(path)) end |