Class: SevenZipRuby::UpdateInfo
- Inherits:
-
Object
- Object
- SevenZipRuby::UpdateInfo
- Defined in:
- lib/seven_zip_ruby/update_info.rb
Instance Attribute Summary collapse
-
#atime ⇒ Object
readonly
Returns the value of attribute atime.
-
#attrib ⇒ Object
readonly
Returns the value of attribute attrib.
-
#ctime ⇒ Object
readonly
Returns the value of attribute ctime.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#index_in_archive ⇒ Object
readonly
Returns the value of attribute index_in_archive.
-
#mtime ⇒ Object
readonly
Returns the value of attribute mtime.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#posix_attrib ⇒ Object
readonly
Returns the value of attribute posix_attrib.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
- .buffer(name, data, opt = {}) ⇒ Object
- .dir(name, opt = {}) ⇒ Object
- .file(name, filepath, szw) ⇒ Object
Instance Method Summary collapse
- #anti? ⇒ Boolean
- #buffer? ⇒ Boolean
- #directory? ⇒ Boolean
- #file? ⇒ Boolean
-
#initialize(type, param) ⇒ UpdateInfo
constructor
A new instance of UpdateInfo.
- #initialize_buffer(name, data, opt) ⇒ Object
- #initialize_dir(name, opt) ⇒ Object
- #initialize_file(name, filepath, szw) ⇒ Object
- #new_data? ⇒ Boolean
- #new_properties? ⇒ Boolean
Constructor Details
#initialize(type, param) ⇒ UpdateInfo
Returns a new instance of UpdateInfo.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/seven_zip_ruby/update_info.rb', line 17 def initialize(type, param) @type = type case(type) when :buffer name = param.delete(:name) data = param.delete(:data) initialize_buffer(name, data, param) when :dir name = param.delete(:name) initialize_dir(name, param) when :file initialize_file(param[:name], param[:filepath], param[:szw]) end end |
Instance Attribute Details
#atime ⇒ Object (readonly)
Returns the value of attribute atime.
90 91 92 |
# File 'lib/seven_zip_ruby/update_info.rb', line 90 def atime @atime end |
#attrib ⇒ Object (readonly)
Returns the value of attribute attrib.
90 91 92 |
# File 'lib/seven_zip_ruby/update_info.rb', line 90 def attrib @attrib end |
#ctime ⇒ Object (readonly)
Returns the value of attribute ctime.
90 91 92 |
# File 'lib/seven_zip_ruby/update_info.rb', line 90 def ctime @ctime end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
90 91 92 |
# File 'lib/seven_zip_ruby/update_info.rb', line 90 def data @data end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
90 91 92 |
# File 'lib/seven_zip_ruby/update_info.rb', line 90 def group @group end |
#index_in_archive ⇒ Object (readonly)
Returns the value of attribute index_in_archive.
90 91 92 |
# File 'lib/seven_zip_ruby/update_info.rb', line 90 def index_in_archive @index_in_archive end |
#mtime ⇒ Object (readonly)
Returns the value of attribute mtime.
90 91 92 |
# File 'lib/seven_zip_ruby/update_info.rb', line 90 def mtime @mtime end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
90 91 92 |
# File 'lib/seven_zip_ruby/update_info.rb', line 90 def path @path end |
#posix_attrib ⇒ Object (readonly)
Returns the value of attribute posix_attrib.
90 91 92 |
# File 'lib/seven_zip_ruby/update_info.rb', line 90 def posix_attrib @posix_attrib end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
90 91 92 |
# File 'lib/seven_zip_ruby/update_info.rb', line 90 def size @size end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
90 91 92 |
# File 'lib/seven_zip_ruby/update_info.rb', line 90 def user @user end |
Class Method Details
.buffer(name, data, opt = {}) ⇒ Object
4 5 6 |
# File 'lib/seven_zip_ruby/update_info.rb', line 4 def buffer(name, data, opt={}) new(:buffer, opt.merge({ name: name, data: data })) end |
.dir(name, opt = {}) ⇒ Object
8 9 10 |
# File 'lib/seven_zip_ruby/update_info.rb', line 8 def dir(name, opt={}) new(:dir, opt.merge({ name: name })) end |
.file(name, filepath, szw) ⇒ Object
12 13 14 |
# File 'lib/seven_zip_ruby/update_info.rb', line 12 def file(name, filepath, szw) new(:file, { name: name, filepath: filepath, szw: szw }) end |
Instance Method Details
#anti? ⇒ Boolean
112 113 114 |
# File 'lib/seven_zip_ruby/update_info.rb', line 112 def anti? return @anti end |
#buffer? ⇒ Boolean
92 93 94 |
# File 'lib/seven_zip_ruby/update_info.rb', line 92 def buffer? return (@type == :buffer) end |
#directory? ⇒ Boolean
96 97 98 |
# File 'lib/seven_zip_ruby/update_info.rb', line 96 def directory? return @dir end |
#file? ⇒ Boolean
100 101 102 |
# File 'lib/seven_zip_ruby/update_info.rb', line 100 def file? return !(@dir) end |
#initialize_buffer(name, data, opt) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/seven_zip_ruby/update_info.rb', line 32 def initialize_buffer(name, data, opt) @index_in_archive = nil @new_data = true @new_properties = true @anti = false @path = name @dir = false @data = data @size = data.size @attrib = 0x20 @posix_attrib = 0x00 time = Time.now @ctime = (opt[:ctime] || time) @atime = (opt[:atime] || time) @mtime = (opt[:mtime] || time) @user = @group = nil end |
#initialize_dir(name, opt) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/seven_zip_ruby/update_info.rb', line 51 def initialize_dir(name, opt) @index_in_archive = nil @new_data = true @new_properties = true @anti = false @path = name @dir = true @data = nil @size = 0 @attrib = 0x10 @posix_attrib = 0x00 time = Time.now @ctime = (opt[:ctime] || time) @atime = (opt[:atime] || time) @mtime = (opt[:mtime] || time) @user = @group = nil end |
#initialize_file(name, filepath, szw) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/seven_zip_ruby/update_info.rb', line 70 def initialize_file(name, filepath, szw) @index_in_archive = nil @new_data = true @new_properties = true @anti = false @path = name.to_s @dir = false filepath = Pathname(filepath). @data = filepath.to_s @size = filepath.size @attrib = (szw.get_file_attribute(filepath.to_s) || 0x20) @posix_attrib = 0x00 @ctime = filepath.ctime @atime = filepath.atime @mtime = filepath.mtime @user = @group = nil end |
#new_data? ⇒ Boolean
104 105 106 |
# File 'lib/seven_zip_ruby/update_info.rb', line 104 def new_data? return @new_data end |
#new_properties? ⇒ Boolean
108 109 110 |
# File 'lib/seven_zip_ruby/update_info.rb', line 108 def new_properties? return @new_properties end |