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.
94 95 96 |
# File 'lib/rsync/change.rb', line 94 def acl attribute_prop(9) end |
#changed? ⇒ Boolean
Whether the file was changed or not.
24 25 26 27 28 29 30 |
# File 'lib/rsync/change.rb', line 24 def changed? if update_type == :no_change false else true end end |
#checksum ⇒ Symbol
The change, if any, to the checksum of the file.
58 59 60 |
# File 'lib/rsync/change.rb', line 58 def checksum attribute_prop(2) end |
#ext_attr ⇒ Symbol
The change, if any, to the file’s extended attributes.
100 101 102 |
# File 'lib/rsync/change.rb', line 100 def ext_attr attribute_prop(10) end |
#file_type ⇒ Symbol
The type of file.
:file
:directory
:symlink
:device
:special
142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/rsync/change.rb', line 142 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.
88 89 90 |
# File 'lib/rsync/change.rb', line 88 def group attribute_prop(7) end |
#owner ⇒ Symbol
The change, if any, to the owner of the file.
82 83 84 |
# File 'lib/rsync/change.rb', line 82 def owner attribute_prop(6) end |
#permissions ⇒ Symbol
The change, if any, to the file permissions.
76 77 78 |
# File 'lib/rsync/change.rb', line 76 def attribute_prop(5) end |
#size ⇒ Symbol
The change, if any, to the size of the file.
64 65 66 |
# File 'lib/rsync/change.rb', line 64 def size attribute_prop(3) end |
#summary ⇒ String
Simple description of the change.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rsync/change.rb', line 34 def summary if update_type == :message elsif update_type == :recv and @data[2,9] == "+++++++++" "creating local" elsif update_type == :recv "updating local" elsif update_type == :sent and @data[2,9] == "+++++++++" "creating remote" elsif update_type == :sent "updating remote" else changes = [] [:checksum, :size, :timestamp, :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.
70 71 72 |
# File 'lib/rsync/change.rb', line 70 def attribute_prop(4) end |
#update_type ⇒ Symbol
The type of update made to the file.
:sent
:recv
:change
:hard_link
:no_update
:message
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/rsync/change.rb', line 116 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 |