Class: Rsync::Change
- Inherits:
-
Object
- Object
- Rsync::Change
- Defined in:
- lib/rsync/change.rb
Overview
Provides details about changes made to a specific file.
Change Flags:
:no_change
:identical
:new
:unknown
:changed
Change Flags collapse
-
#acl ⇒ Symbol
The change, if any, to the file ACL.
-
#checksum ⇒ Symbol
The change, if any, to the checksum of the file.
-
#ext_attr ⇒ Symbol
The change, if any, to the file’s extended attributes.
-
#group ⇒ Symbol
The change, if any, to the group of the file.
-
#owner ⇒ Symbol
The change, if any, to the owner of the file.
-
#permissions ⇒ Symbol
The change, if any, to the file permissions.
-
#size ⇒ Symbol
The change, if any, to the size of the file.
-
#timestamp ⇒ Symbol
The change, if any, to the timestamp of the file.
Instance Method Summary collapse
-
#changed? ⇒ Boolean
Whether the file was changed or not.
-
#file_type ⇒ Symbol
The type of file.
-
#filename ⇒ String
The filename associated with this change.
-
#initialize(data) ⇒ Change
constructor
A new instance of Change.
-
#summary ⇒ String
Simple description of the change.
-
#update_type ⇒ Symbol
The type of update made to the file.
Constructor Details
#initialize(data) ⇒ Change
Returns a new instance of Change.
12 13 14 |
# File 'lib/rsync/change.rb', line 12 def initialize(data) @data = data end |
Instance Method Details
#acl ⇒ Symbol
The change, if any, to the file ACL.
92 93 94 |
# File 'lib/rsync/change.rb', line 92 def acl attribute_prop(9) end |
#changed? ⇒ Boolean
Whether the file was changed or not.
24 25 26 27 28 29 30 31 |
# File 'lib/rsync/change.rb', line 24 def changed? if update_type == :message return true elsif update_type == :recv return true end false end |
#checksum ⇒ Symbol
The change, if any, to the checksum of the file.
56 57 58 |
# File 'lib/rsync/change.rb', line 56 def checksum attribute_prop(2) end |
#ext_attr ⇒ Symbol
The change, if any, to the file’s extended attributes.
98 99 100 |
# File 'lib/rsync/change.rb', line 98 def ext_attr attribute_prop(10) end |
#file_type ⇒ Symbol
The type of file.
:file
:directory
:symlink
:device
:special
140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/rsync/change.rb', line 140 def file_type case raw_file_type when 'f' :file when 'd' :directory when 'L' :symlink when 'D' :device when 'S' :special end end |
#filename ⇒ String
The filename associated with this change.
18 19 20 |
# File 'lib/rsync/change.rb', line 18 def filename @data[12..-1] end |
#group ⇒ Symbol
The change, if any, to the group of the file.
86 87 88 |
# File 'lib/rsync/change.rb', line 86 def group attribute_prop(7) end |
#owner ⇒ Symbol
The change, if any, to the owner of the file.
80 81 82 |
# File 'lib/rsync/change.rb', line 80 def owner attribute_prop(6) end |
#permissions ⇒ Symbol
The change, if any, to the file permissions.
74 75 76 |
# File 'lib/rsync/change.rb', line 74 def attribute_prop(5) end |
#size ⇒ Symbol
The change, if any, to the size of the file.
62 63 64 |
# File 'lib/rsync/change.rb', line 62 def size attribute_prop(3) end |
#summary ⇒ String
Simple description of the change.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rsync/change.rb', line 35 def summary if update_type == :message elsif update_type == :recv and @data[2,9] == "+++++++++" "creating" elsif update_type == :recv "updating" else changes = [] #[:checksum, :size, :timestamp, :permissions, :owner, :group, :acl].each do |prop| [:checksum, :size, :permissions, :owner, :group, :acl].each do |prop| changes << prop if send(prop) == :changed end changes.join(", ") end end |
#timestamp ⇒ Symbol
The change, if any, to the timestamp of the file.
68 69 70 |
# File 'lib/rsync/change.rb', line 68 def attribute_prop(4) end |
#update_type ⇒ Symbol
The type of update made to the file.
:sent
:recv
:change
:hard_link
:no_update
:message
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/rsync/change.rb', line 114 def update_type case raw_update_type when '<' :sent when '>' :recv when 'c' :change when 'h' :hard_link when '.' :no_update when '*' :message end end |