Class: Terminalwire::V2::Server::Context::File
- Inherits:
-
Object
- Object
- Terminalwire::V2::Server::Context::File
- Defined in:
- lib/terminalwire/v2/server/context.rb
Instance Method Summary collapse
- #append(path, content) ⇒ Object
-
#change_mode(path, mode) ⇒ Object
chmod the file to
mode(an integer like 0o755). - #delete(path) ⇒ Object
- #exist?(path) ⇒ Boolean
-
#initialize(runtime) ⇒ File
constructor
A new instance of File.
- #read(path) ⇒ Object
- #write(path, content) ⇒ Object
Constructor Details
#initialize(runtime) ⇒ File
Returns a new instance of File.
225 |
# File 'lib/terminalwire/v2/server/context.rb', line 225 def initialize(runtime) = @runtime = runtime |
Instance Method Details
#append(path, content) ⇒ Object
228 |
# File 'lib/terminalwire/v2/server/context.rb', line 228 def append(path, content) = @runtime.request(:file, :append, { "path" => path.to_s, "content" => content }) |
#change_mode(path, mode) ⇒ Object
chmod the file to mode (an integer like 0o755). The client requires an
rw grant on the path and rejects a missing mode.
233 |
# File 'lib/terminalwire/v2/server/context.rb', line 233 def change_mode(path, mode) = @runtime.request(:file, :change_mode, { "path" => path.to_s, "mode" => mode }) |
#delete(path) ⇒ Object
229 |
# File 'lib/terminalwire/v2/server/context.rb', line 229 def delete(path) = @runtime.request(:file, :delete, { "path" => path.to_s }) |
#exist?(path) ⇒ Boolean
230 231 232 |
# File 'lib/terminalwire/v2/server/context.rb', line 230 def exist?(path) = @runtime.request(:file, :exist, { "path" => path.to_s }) # chmod the file to `mode` (an integer like 0o755). The client requires an # rw grant on the path and rejects a missing mode. |
#read(path) ⇒ Object
226 |
# File 'lib/terminalwire/v2/server/context.rb', line 226 def read(path) = @runtime.request(:file, :read, { "path" => path.to_s }) |
#write(path, content) ⇒ Object
227 |
# File 'lib/terminalwire/v2/server/context.rb', line 227 def write(path, content) = @runtime.request(:file, :write, { "path" => path.to_s, "content" => content }) |