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.
43 44 45 |
# File 'lib/rio/exception/copy.rb', line 43 def dst @dst end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
42 43 44 |
# File 'lib/rio/exception/copy.rb', line 42 def src @src end |
#syserr ⇒ Object (readonly)
Returns the value of attribute syserr.
41 42 43 |
# File 'lib/rio/exception/copy.rb', line 41 def syserr @syserr end |
Instance Method Details
#dir_info(f) ⇒ Object
65 66 67 68 |
# File 'lib/rio/exception/copy.rb', line 65 def dir_info(f) return unless f.dir? return "is a directory" end |
#explain ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/rio/exception/copy.rb', line 82 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
52 53 54 55 |
# File 'lib/rio/exception/copy.rb', line 52 def file_info(f) return unless f.file? "is a file" end |
#finfo(f) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/rio/exception/copy.rb', line 69 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
49 50 51 |
# File 'lib/rio/exception/copy.rb', line 49 def submsg(s) "\n\t" + s end |
#symlink_info(f) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/rio/exception/copy.rb', line 56 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 |