Exception: RIO::Exception::Copy
- Defined in:
- lib/rio/exception/copy.rb
Instance Attribute Summary collapse
-
#dst ⇒ Object
readonly
Returns the value of attribute dst.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
-
#syserr ⇒ Object
readonly
Returns the value of attribute syserr.
Instance Method Summary collapse
- #dir_info(f) ⇒ Object
- #explain ⇒ Object
- #file_info(f) ⇒ Object
- #finfo(f) ⇒ Object
-
#initialize(s, d, rerror) ⇒ Copy
constructor
A new instance of Copy.
- #submsg(s) ⇒ Object
- #symlink_info(f) ⇒ Object
Constructor Details
Instance Attribute Details
#dst ⇒ Object (readonly)
Returns the value of attribute dst.
32 33 34 |
# File 'lib/rio/exception/copy.rb', line 32 def dst @dst end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
31 32 33 |
# File 'lib/rio/exception/copy.rb', line 31 def src @src end |
#syserr ⇒ Object (readonly)
Returns the value of attribute syserr.
30 31 32 |
# File 'lib/rio/exception/copy.rb', line 30 def syserr @syserr end |
Instance Method Details
#dir_info(f) ⇒ Object
54 55 56 57 |
# File 'lib/rio/exception/copy.rb', line 54 def dir_info(f) return unless f.dir? return "is a directory" end |
#explain ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/rio/exception/copy.rb', line 71 def explain() s = "#{self.class}: failed copying '#{@src}' => #{@dst}" s += submsg("Err: #{@syserr}") if @syserr s += submsg("Src: '#{@src}' " + finfo(@src)) s += submsg("Dst: '#{@dst}' " + finfo(@dst)) target = ::RIO::rio(@dst,@src.filename) if @dst.dir? p target if target.exist? s += submsg("Tgt: '#{target} " + finfo(target)) end s += "\n" end |
#file_info(f) ⇒ Object
41 42 43 44 |
# File 'lib/rio/exception/copy.rb', line 41 def file_info(f) return unless f.file? "is a file" end |
#finfo(f) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/rio/exception/copy.rb', line 58 def finfo(f) case when (not f.exist?) return "does not exist" when f.symlink? return symlink_info(f) when f.dir? return dir_info(f) when f.file? return file_info(f) end return "" end |
#submsg(s) ⇒ Object
38 39 40 |
# File 'lib/rio/exception/copy.rb', line 38 def submsg(s) "\n\t" + s end |
#symlink_info(f) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/rio/exception/copy.rb', line 45 def symlink_info(f) return unless f.symlink? t = f.readlink s = "is a symlink refering to #{t}" f.dirname.chdir { s += submsg(" : '#{t}' " + finfo(t)) } return s end |