summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-08-11 00:25:49 -0400
committerPaul Duncan <pabs@pablotron.org>2016-08-11 00:25:49 -0400
commit0051061737064118f067c7c313f9935ed66e6109 (patch)
tree458a41ec57fe84e9cb989a39eab8f7133cacc90f /src
parent1b273022bdb7055c3679583389504e080359ea43 (diff)
downloadzip-crystal-0051061737064118f067c7c313f9935ed66e6109.tar.bz2
zip-crystal-0051061737064118f067c7c313f9935ed66e6109.zip
add version documentation
Diffstat (limited to 'src')
-rw-r--r--src/zip.cr23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/zip.cr b/src/zip.cr
index 29e8e36..d1fff61 100644
--- a/src/zip.cr
+++ b/src/zip.cr
@@ -16,6 +16,7 @@ require "zlib"
# [ ] zip64
# [ ] legacy unicode (e.g., non-bit 11) path/comment support
# [ ] unix uids
+# [ ] encryption
# [ ] bzip2/lzma support
#
# References:
@@ -340,6 +341,12 @@ module Zip
#
# See section 4.4.3.2 of APPNOTE.TXT for version details.
#
+ # Example:
+ #
+ # # create version and print it out
+ # version = Zip::Version.new(5, 0)
+ # puts "version = #{version}"
+ #
class Version
#
# Version needed to extract this entry (4.4.3.2).
@@ -355,6 +362,12 @@ module Zip
# Create a version identifier from a major number, minor number, and
# optional compatability number.
#
+ # Example:
+ #
+ # # create version and print it out
+ # version = Zip::Version.new(5, 0)
+ # puts "version = #{version}"
+ #
def initialize(
@major : Int32,
@minor : Int32,
@@ -366,6 +379,9 @@ module Zip
# Create a version identifier from a major number, minor number, and
# optional compatability number.
#
+ # You shouldn't need to call this constructor directly; it is used
+ # by internal classes.
+ #
def initialize(v : UInt16)
@compat = v >> 8
@major = (v & 0xff) / 10
@@ -375,6 +391,10 @@ module Zip
#
# Write version as string.
#
+ # # create version and print it out
+ # version = Zip::Version.new(5, 0)
+ # puts "version = #{version}"
+ #
def to_s(io)
io << @major << "." << @minor
end
@@ -383,6 +403,9 @@ module Zip
# Write version as 16-bit, little-endian integer and return number
# of bytes written.
#
+ # You shouldn't need to call this method directly; it is used by
+ # internal classes.
+ #
def to_io(io)
(
((@compat & 0xff) << 8) +