File: linux.rb

package info (click to toggle)
ruby-train 3.13.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,208 kB
  • sloc: ruby: 10,002; sh: 17; makefile: 8
file content (19 lines) | stat: -rw-r--r-- 435 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require_relative "unix"

module Train
  class File
    class Remote
      class Linux < Train::File::Remote::Unix
        def content
          return @content if defined?(@content)

          @content = @backend.run_command("cat #{@spath} || echo -n").stdout
          return @content unless @content.empty?

          @content = nil if directory? || size.nil? || (size > 0)
          @content
        end
      end
    end
  end
end