Ascii85 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dcb6cc7ca3f3ca02c235e5a0d5b908396524e265c9adaaf56c50bc62117c5ee7
4
+ data.tar.gz: c005e9a67ecc1def46d040f06e91cb7984d0cfd43d9729638d60b2fe19d2ab8c
5
+ SHA512:
6
+ metadata.gz: c6fef31cebe36d41eee64ff857e87007b176b262fc4c667666f6360714b9d15274afb192572cf5bba31953f13ecde7c1b1ea60697ebf83a43dc80b35f64d94dd
7
+ data.tar.gz: 2bd0e1367f729cb42d2163e5eeeba540e243138a23cfeb6bf9e2d93d49c80dc12227d65b60bd1db2f6272ab8c9bac19d0aaac37a5e9d48e14dd50d45abb8a749
data/.travis.yml ADDED
@@ -0,0 +1,30 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
7
+ - 2.3
8
+ - 2.4
9
+ - 2.5
10
+ - 2.6
11
+ - 2.7
12
+ - ruby-head
13
+ - jruby
14
+ - truffleruby
15
+ env:
16
+ - RUBYOPT="--enable-frozen-string-literal"
17
+ - RUBYOPT=""
18
+ matrix:
19
+ exclude:
20
+ - rvm: 1.9
21
+ env: RUBYOPT="--enable-frozen-string-literal"
22
+ - rvm: 2.0
23
+ env: RUBYOPT="--enable-frozen-string-literal"
24
+ - rvm: 2.1
25
+ env: RUBYOPT="--enable-frozen-string-literal"
26
+ - rvm: 2.2
27
+ env: RUBYOPT="--enable-frozen-string-literal"
28
+ # bundler did not support this back then
29
+ - rvm: 2.3
30
+ env: RUBYOPT="--enable-frozen-string-literal"
data/Ascii85.gemspec CHANGED
@@ -7,14 +7,12 @@ Gem::Specification.new do |s|
7
7
  s.version = Ascii85::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.author = "Johannes Holzfuß"
10
- s.email = "DataWraith@web.de"
10
+ s.email = "johannes@holzfuss.name"
11
11
  s.license = 'MIT'
12
- s.homepage = "http://rubyforge.org/projects/ascii85/"
12
+ s.homepage = "https://github.com/DataWraith/ascii85gem/"
13
13
  s.summary = %q{Ascii85 encoder/decoder}
14
14
  s.description = %q{Ascii85 provides methods to encode/decode Adobe's binary-to-text encoding of the same name.}
15
15
 
16
- s.rubyforge_project = "Ascii85"
17
-
18
16
  s.add_development_dependency "bundler", ">= 1.0.0"
19
17
  s.add_development_dependency "minitest",">= 2.6.0"
20
18
  s.add_development_dependency "rake", ">= 0.9.2"
@@ -23,5 +21,5 @@ Gem::Specification.new do |s|
23
21
  s.test_files = `git ls-files -- spec/*`.split("\n")
24
22
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
23
  s.require_paths = ["lib"]
26
- s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
24
+ s.extra_rdoc_files = ['README.md', 'LICENSE']
27
25
  end
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ === 1.1.0 / 2020-11-11
2
+
3
+ * Make use of frozen_string_literal
4
+ * Update tests to use newer minitest syntax
5
+
6
+ === 1.0.3 / 2018-01-25
7
+
8
+ * Updated the gem's metadata
9
+
1
10
  === 1.0.2 / 2012-09-16
2
11
 
3
12
  * Changed test runner from RSpec to MiniSpec
data/README.md ADDED
@@ -0,0 +1,69 @@
1
+ **Status**: This project is in maintenance mode. I will not develop new features, but I will address Issues and Pull Requests.
2
+
3
+ # Ascii85
4
+
5
+ [![Build Status](https://travis-ci.org/DataWraith/ascii85gem.svg?branch=master)](https://travis-ci.org/DataWraith/ascii85gem)
6
+
7
+ ## Description
8
+
9
+ Ascii85 is a simple gem that provides methods for encoding/decoding Adobe's
10
+ binary-to-text encoding of the same name.
11
+
12
+ See http://www.adobe.com/products/postscript/pdfs/PLRM.pdf page 131 and
13
+ http://en.wikipedia.org/wiki/Ascii85 for more information about the format.
14
+
15
+
16
+ ## Installation
17
+
18
+ `sudo gem install Ascii85`
19
+
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ require 'rubygems'
25
+ require 'ascii85'
26
+
27
+ Ascii85.encode("Ruby")
28
+ => "<~;KZGo~>"
29
+
30
+ Ascii85.decode("<~;KZGo~>")
31
+ => "Ruby"
32
+ ```
33
+
34
+ In addition, Ascii85.encode can take a second parameter that specifies the
35
+ length of the returned lines. The default is 80; use `false` for unlimited.
36
+
37
+ Ascii85.decode expects the input to be enclosed in <~ and ~> — it
38
+ ignores everything outside of these. The output of Ascii85.decode
39
+ will have the ASCII-8BIT encoding, so in Ruby 1.9 you may have to use
40
+ <tt>String#force_encoding</tt> to correct the encoding.
41
+
42
+
43
+ ## Command-line utility
44
+
45
+ This gem includes `ascii85`, a command-line utility modeled after `base64` from
46
+ the GNU coreutils. It can be used to encode/decode Ascii85 directly from the
47
+ command-line:
48
+
49
+ ```
50
+ Usage: ascii85 [OPTIONS] [FILE]
51
+ Encodes or decodes FILE or STDIN using Ascii85 and writes to STDOUT.
52
+ -w, --wrap COLUMN Wrap lines at COLUMN. Default is 80, use 0 for no wrapping
53
+ -d, --decode Decode the input
54
+ -h, --help Display this help and exit
55
+ --version Output version information
56
+ ```
57
+
58
+
59
+ ## Contributors
60
+
61
+ Thank you for your contribution!
62
+
63
+ * [@aliismayilov](https://github.com/aliismayilov) contributed frozen String handling
64
+
65
+
66
+ ## License
67
+
68
+ Ascii85 is distributed under the MIT License. See the accompanying LICENSE file
69
+ for details.
data/bin/ascii85 CHANGED
@@ -51,7 +51,6 @@ ARGV.options do |opts|
51
51
  else
52
52
  abort "Superfluous operand(s): \"#{remaining_args.join('", "')}\""
53
53
  end
54
-
55
54
  end
56
55
 
57
56
  if @options[:file] == '-'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ascii85
2
- VERSION = "1.0.2"
4
+ VERSION = "1.1.0"
3
5
  end
data/lib/ascii85.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
2
3
 
3
4
 
4
5
  #
@@ -9,13 +10,12 @@
9
10
  # and http://en.wikipedia.org/wiki/Ascii85 for more information about
10
11
  # the format.
11
12
  #
12
- # Author:: Johannes Holzfuß (DataWraith@web.de)
13
+ # Author:: Johannes Holzfuß (johannes@holzfuss.name)
13
14
  # License:: Distributed under the MIT License (see LICENSE file)
14
15
  #
15
16
 
16
17
 
17
18
  module Ascii85
18
-
19
19
  #
20
20
  # Encodes the bytes of the given String as Ascii85.
21
21
  #
@@ -37,7 +37,6 @@ module Ascii85
37
37
  #
38
38
  #
39
39
  def self.encode(str, wrap_lines = 80)
40
-
41
40
  to_encode = str.to_s
42
41
  return '' if to_encode.empty?
43
42
 
@@ -59,7 +58,7 @@ module Ascii85
59
58
  if tuple == 0
60
59
  'z'
61
60
  else
62
- tmp = ""
61
+ tmp = String.new
63
62
  5.times do
64
63
  tmp << ((tuple % 85) + 33).chr
65
64
  tuple /= 85
@@ -82,7 +81,6 @@ module Ascii85
82
81
  end
83
82
 
84
83
  # Otherwise we wrap the lines
85
-
86
84
  line_length = [2, wrap_lines.to_i].max
87
85
 
88
86
  wrapped = []
@@ -122,7 +120,6 @@ module Ascii85
122
120
  # encountered.
123
121
  #
124
122
  def self.decode(str)
125
-
126
123
  input = str.to_s
127
124
 
128
125
  opening_delim = '<~'
@@ -134,9 +131,9 @@ module Ascii85
134
131
  # errors if an especially exotic input encoding is introduced.
135
132
  # As of Ruby 1.9.2 all non-dummy encodings work fine though.
136
133
  #
137
- if opening_delim.respond_to?(:encode!)
138
- opening_delim.encode!(input.encoding)
139
- closing_delim.encode!(input.encoding)
134
+ if opening_delim.respond_to?(:encode)
135
+ opening_delim = opening_delim.encode(input.encoding)
136
+ closing_delim = closing_delim.encode(input.encoding)
140
137
  end
141
138
 
142
139
  # Get the positions of the opening/closing delimiters. If there is
@@ -153,7 +150,6 @@ module Ascii85
153
150
  result = []
154
151
 
155
152
  input.each_byte do |c|
156
-
157
153
  case c.chr
158
154
  when " ", "\t", "\r", "\n", "\f", "\0"
159
155
  # Ignore whitespace
@@ -189,7 +185,6 @@ module Ascii85
189
185
  raise(Ascii85::DecodingError,
190
186
  "Illegal character inside Ascii85: #{c.chr.dump}")
191
187
  end
192
-
193
188
  end
194
189
 
195
190
  # Convert result into a String
@@ -225,5 +220,4 @@ module Ascii85
225
220
  # at least two characters.
226
221
  #
227
222
  class DecodingError < StandardError; end
228
-
229
223
  end
@@ -7,11 +7,9 @@ require 'minitest/autorun'
7
7
  require File.expand_path('../../../lib/ascii85', __FILE__)
8
8
 
9
9
  describe Ascii85 do
10
-
11
10
  UNSUPPORTED_MSG = "This version of Ruby does not support encodings"
12
11
 
13
12
  TEST_CASES = {
14
-
15
13
  "" => "",
16
14
  " " => "<~+9~>",
17
15
 
@@ -44,9 +42,8 @@ describe Ascii85 do
44
42
  }
45
43
 
46
44
  it "#decode should be the inverse of #encode" do
47
-
48
45
  # Generate a random string
49
- test_str = ""
46
+ test_str = String.new
50
47
  (1 + rand(255)).times do
51
48
  test_str << rand(256).chr
52
49
  end
@@ -54,14 +51,13 @@ describe Ascii85 do
54
51
  encoded = Ascii85.encode(test_str)
55
52
  decoded = Ascii85.decode(encoded)
56
53
 
57
- decoded.must_equal test_str
54
+ assert_equal decoded, test_str
58
55
  end
59
56
 
60
57
  describe "#encode" do
61
-
62
58
  it "should encode all specified test-cases correctly" do
63
59
  TEST_CASES.each_pair do |input, encoded|
64
- Ascii85.encode(input).must_equal encoded
60
+ assert_equal Ascii85.encode(input), encoded
65
61
  end
66
62
  end
67
63
 
@@ -73,7 +69,7 @@ describe Ascii85 do
73
69
  input_EUC_JP = 'どうもありがとうミスターロボット'.encode('EUC-JP')
74
70
  input_binary = input_EUC_JP.force_encoding('ASCII-8BIT')
75
71
 
76
- Ascii85.encode(input_EUC_JP).must_equal Ascii85.encode(input_binary)
72
+ assert_equal Ascii85.encode(input_EUC_JP), Ascii85.encode(input_binary)
77
73
  end
78
74
 
79
75
  it "should produce output lines no longer than specified" do
@@ -82,7 +78,7 @@ describe Ascii85 do
82
78
  #
83
79
  # No wrap
84
80
  #
85
- Ascii85.encode(test_str, false).count("\n").must_equal 0
81
+ assert_equal Ascii85.encode(test_str, false).count("\n"), 0
86
82
 
87
83
  #
88
84
  # x characters per line, except for the last one
@@ -107,23 +103,21 @@ describe Ascii85 do
107
103
  count_arr.delete_if { |len| len == x }
108
104
 
109
105
  # Now count_arr should be empty
110
- count_arr.must_be_empty
106
+ assert_empty count_arr
111
107
  end
112
108
 
113
109
  it "should not split the end-marker to achieve correct line length" do
114
- Ascii85.encode("\0" * 4, 4).must_equal "<~z\n~>"
110
+ assert_equal Ascii85.encode("\0" * 4, 4), "<~z\n~>"
115
111
  end
116
-
117
112
  end
118
113
 
119
114
  describe "#decode" do
120
-
121
115
  it "should decode all specified test-cases correctly" do
122
116
  TEST_CASES.each_pair do |decoded, input|
123
117
  if String.new.respond_to?(:encoding)
124
- Ascii85.decode(input).must_equal decoded.dup.force_encoding('ASCII-8BIT')
118
+ assert_equal Ascii85.decode(input), decoded.dup.force_encoding('ASCII-8BIT')
125
119
  else
126
- Ascii85.decode(input).must_equal decoded
120
+ assert_equal Ascii85.decode(input), decoded
127
121
  end
128
122
  end
129
123
  end
@@ -149,7 +143,7 @@ describe Ascii85 do
149
143
 
150
144
  begin
151
145
  to_test = input_ascii85.encode(encoding)
152
- Ascii85.decode(to_test).force_encoding('UTF-8').must_equal input
146
+ assert_equal Ascii85.decode(to_test).force_encoding('UTF-8'), input
153
147
  rescue Encoding::ConverterNotFoundError
154
148
  # Ignore this encoding
155
149
  end
@@ -157,19 +151,19 @@ describe Ascii85 do
157
151
  end
158
152
 
159
153
  it "should only process data within delimiters" do
160
- Ascii85.decode("<~~>").must_be_empty
161
- Ascii85.decode("Doesn't contain delimiters").must_be_empty
162
- Ascii85.decode("Mismatched ~> delimiters 1").must_be_empty
163
- Ascii85.decode("Mismatched <~ delimiters 2").must_be_empty
164
- Ascii85.decode("Mismatched ~><~ delimiters 3").must_be_empty
165
-
166
- Ascii85.decode("<~;KZGo~><~z~>").must_equal "Ruby"
167
- Ascii85.decode("FooBar<~z~>BazQux").must_equal "\0\0\0\0"
154
+ assert_empty Ascii85.decode("<~~>")
155
+ assert_empty Ascii85.decode("Doesn't contain delimiters")
156
+ assert_empty Ascii85.decode("Mismatched ~> delimiters 1")
157
+ assert_empty Ascii85.decode("Mismatched <~ delimiters 2")
158
+ assert_empty Ascii85.decode("Mismatched ~><~ delimiters 3")
159
+
160
+ assert_equal Ascii85.decode("<~;KZGo~><~z~>"), "Ruby"
161
+ assert_equal Ascii85.decode("FooBar<~z~>BazQux"), "\0\0\0\0"
168
162
  end
169
163
 
170
164
  it "should ignore whitespace" do
171
165
  decoded = Ascii85.decode("<~6 #LdYA\r\08\n \n\n- *rF*(i\"Ch[s \t(D.RU,@ <-\'jDJ=0\f/~>")
172
- decoded.must_equal 'Antidisestablishmentarianism'
166
+ assert_equal decoded, 'Antidisestablishmentarianism'
173
167
  end
174
168
 
175
169
  it "should return ASCII-8BIT encoded strings" do
@@ -177,29 +171,25 @@ describe Ascii85 do
177
171
  skip(UNSUPPORTED_MSG)
178
172
  end
179
173
 
180
- Ascii85.decode("<~;KZGo~>").encoding.name.must_equal "ASCII-8BIT"
174
+ assert_equal Ascii85.decode("<~;KZGo~>").encoding.name, "ASCII-8BIT"
181
175
  end
182
176
 
183
177
  describe "Error conditions" do
184
-
185
178
  it "should raise DecodingError if it encounters a word >= 2**32" do
186
- lambda { Ascii85.decode('<~s8W-#~>') }.must_raise(Ascii85::DecodingError)
179
+ assert_raises(Ascii85::DecodingError) { Ascii85.decode('<~s8W-#~>') }
187
180
  end
188
181
 
189
182
  it "should raise DecodingError if it encounters an invalid character" do
190
- lambda { Ascii85.decode('<~!!y!!~>') }.must_raise(Ascii85::DecodingError)
183
+ assert_raises(Ascii85::DecodingError) { Ascii85.decode('<~!!y!!~>') }
191
184
  end
192
185
 
193
186
  it "should raise DecodingError if the last tuple consists of a single character" do
194
- lambda { Ascii85.decode('<~!~>') }.must_raise(Ascii85::DecodingError)
187
+ assert_raises(Ascii85::DecodingError) { Ascii85.decode('<~!~>') }
195
188
  end
196
189
 
197
190
  it "should raise DecodingError if a z is found inside a 5-tuple" do
198
- lambda { Ascii85.decode('<~!!z!!~>') }.must_raise Ascii85::DecodingError
191
+ assert_raises(Ascii85::DecodingError) { Ascii85.decode('<~!!z!!~>') }
199
192
  end
200
-
201
193
  end
202
-
203
194
  end
204
-
205
195
  end
metadata CHANGED
@@ -1,98 +1,100 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: Ascii85
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
6
5
  platform: ruby
7
- authors:
8
- - "Johannes Holzfu\xC3\x9F"
6
+ authors:
7
+ - Johannes Holzfuß
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2012-09-16 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: bundler
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.0.0
24
- type: :development
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: minitest
28
- prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 2.6.0
35
- type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: rake
39
- prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: 0.9.2
46
- type: :development
47
- version_requirements: *id003
48
- description: Ascii85 provides methods to encode/decode Adobe's binary-to-text encoding of the same name.
49
- email: DataWraith@web.de
50
- executables:
51
- - ascii85
11
+ date: 2020-11-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.6.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 2.6.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.9.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.2
55
+ description: Ascii85 provides methods to encode/decode Adobe's binary-to-text encoding
56
+ of the same name.
57
+ email: johannes@holzfuss.name
58
+ executables:
59
+ - ascii85
52
60
  extensions: []
53
-
54
- extra_rdoc_files:
55
- - README.rdoc
56
- - LICENSE
57
- files:
58
- - .gemtest
59
- - Ascii85.gemspec
60
- - Gemfile
61
- - History.txt
62
- - LICENSE
63
- - README.rdoc
64
- - Rakefile
65
- - bin/ascii85
66
- - lib/Ascii85/version.rb
67
- - lib/ascii85.rb
68
- - spec/lib/ascii85_spec.rb
69
- homepage: http://rubyforge.org/projects/ascii85/
70
- licenses:
71
- - MIT
61
+ extra_rdoc_files:
62
+ - README.md
63
+ - LICENSE
64
+ files:
65
+ - ".travis.yml"
66
+ - Ascii85.gemspec
67
+ - Gemfile
68
+ - History.txt
69
+ - LICENSE
70
+ - README.md
71
+ - Rakefile
72
+ - bin/ascii85
73
+ - lib/Ascii85/version.rb
74
+ - lib/ascii85.rb
75
+ - spec/lib/ascii85_spec.rb
76
+ homepage: https://github.com/DataWraith/ascii85gem/
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
72
80
  post_install_message:
73
81
  rdoc_options: []
74
-
75
- require_paths:
76
- - lib
77
- required_ruby_version: !ruby/object:Gem::Requirement
78
- none: false
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: "0"
83
- required_rubygems_version: !ruby/object:Gem::Requirement
84
- none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: "0"
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
89
94
  requirements: []
90
-
91
- rubyforge_project: Ascii85
92
- rubygems_version: 1.8.24
95
+ rubygems_version: 3.1.4
93
96
  signing_key:
94
- specification_version: 3
97
+ specification_version: 4
95
98
  summary: Ascii85 encoder/decoder
96
- test_files:
97
- - spec/lib/ascii85_spec.rb
98
- has_rdoc:
99
+ test_files:
100
+ - spec/lib/ascii85_spec.rb
data/.gemtest DELETED
File without changes
data/README.rdoc DELETED
@@ -1,57 +0,0 @@
1
- = Ascii85
2
-
3
- * http://rubyforge.org/projects/ascii85
4
-
5
-
6
- == Description
7
-
8
- Ascii85 is a simple gem that provides methods for encoding/decoding Adobe's
9
- binary-to-text encoding of the same name.
10
-
11
- See http://www.adobe.com/products/postscript/pdfs/PLRM.pdf page 131 and
12
- http://en.wikipedia.org/wiki/Ascii85 for more information about the format.
13
-
14
-
15
- == Installation
16
-
17
- * sudo gem install Ascii85
18
-
19
-
20
- == Usage
21
-
22
- require 'rubygems'
23
- require 'ascii85'
24
-
25
- Ascii85.encode("Ruby")
26
- => "<~;KZGo~>"
27
-
28
- Ascii85.decode("<~;KZGo~>")
29
- => "Ruby"
30
-
31
- In addition, Ascii85.encode can take a second parameter that specifies the
32
- length of the returned lines. The default is 80; use +false+ for unlimited.
33
-
34
- Ascii85.decode expects the input to be enclosed in <~ and ~> — it
35
- ignores everything outside of these. The output of Ascii85.decode
36
- will have the ASCII-8BIT encoding, so in Ruby 1.9 you may have to use
37
- <tt>String#force_encoding</tt> to correct the encoding.
38
-
39
-
40
- == Command-line utility
41
-
42
- This gem includes +ascii85+, a command-line utility modeled after +base64+ from
43
- the GNU coreutils. It can be used to encode/decode Ascii85 directly from the
44
- command-line:
45
-
46
- Usage: ascii85 [OPTIONS] [FILE]
47
- Encodes or decodes FILE or STDIN using Ascii85 and writes to STDOUT.
48
- -w, --wrap COLUMN Wrap lines at COLUMN. Default is 80, use 0 for no wrapping
49
- -d, --decode Decode the input
50
- -h, --help Display this help and exit
51
- --version Output version information
52
-
53
-
54
- == License
55
-
56
- Ascii85 is distributed under the MIT License. See the accompanying LICENSE file
57
- for details.