marcandre-packable 1.3.0 → 1.3.1

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.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ begin
17
17
  The packable library makes (un)packing nicer, smarter and more powerful.
18
18
  EOS
19
19
  gem.authors = ["Marc-André Lafortune"]
20
- gem.rubyforge_project = "marcandre"
20
+ gem.rubyforge_project = "packable"
21
21
  gem.has_rdoc = true
22
22
  gem.rdoc_options << '--title' << 'Packable library' <<
23
23
  '--main' << 'README.rdoc' <<
@@ -99,7 +99,7 @@ begin
99
99
  )
100
100
 
101
101
  host = "#{config['username']}@rubyforge.org"
102
- remote_dir = "/var/www/gforge-projects/marcandre/"
102
+ remote_dir = "/var/www/gforge-projects/packable/"
103
103
  local_dir = 'rdoc'
104
104
 
105
105
  Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 0
2
+ :patch: 1
3
3
  :major: 1
4
4
  :minor: 3
@@ -8,7 +8,6 @@ module Packable
8
8
  base.alias_method_chain :read, :packing
9
9
  base.alias_method_chain :write, :packing
10
10
  base.alias_method_chain :each, :packing
11
- attr_accessor :throw_on_error
12
11
  end
13
12
 
14
13
  # Returns the change in io.pos caused by the block.
@@ -66,10 +65,7 @@ module Packable
66
65
  def read_with_packing(*arg)
67
66
  return read_without_packing(*arg) if (arg.length == 0) || (arg.first.is_a?(Numeric) && (arg.length == 1))
68
67
  values = Packable::Packers.to_class_option_list(*arg).map do |klass, options, original|
69
- if eof?
70
- raise EOFError, "End of IO when attempting to read #{klass} with options #{original.inspect}" if @throw_on_eof
71
- nil
72
- elsif options[:read_packed]
68
+ if options[:read_packed]
73
69
  options[:read_packed].call(self)
74
70
  else
75
71
  klass.read_packed(self, options)
@@ -19,9 +19,11 @@ module Packable
19
19
  end
20
20
 
21
21
  module PackersClassMethod
22
- # Returns or yields a the Packers.for(class)
22
+
23
+ # Returns or yields the <tt>Packers.for(class)</tt>
23
24
  # Normal use is packers.set ...
24
25
  # (see docs or Packers::set for usage)
26
+ #
25
27
  def packers
26
28
  yield packers if block_given?
27
29
  Packers.for(self)
@@ -29,6 +31,7 @@ module Packable
29
31
  end
30
32
 
31
33
  module ClassMethods
34
+
32
35
  def unpack(s, options = :default)
33
36
  return s.unpack(options).first if options.is_a? String
34
37
  StringIO.new(s).packed.read(self, options)
@@ -39,6 +42,7 @@ module Packable
39
42
  # * define a class method +read_packed+ that returns the newly read object
40
43
  # * define an instance method +read_packed+ which reads the io into +self+
41
44
  # * define a class method +unpack_string+ that reads and returns an object from the string. In this case, options[:bytes] should be specified!
45
+ #
42
46
  def read_packed(io, options)
43
47
  if method_defined? :read_packed
44
48
  mandatory = instance_method(:initialize).arity
data/packable.gemspec ADDED
@@ -0,0 +1,63 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{packable}
5
+ s.version = "1.3.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Marc-Andr\303\251 Lafortune"]
9
+ s.date = %q{2009-08-19}
10
+ s.description = %q{If you need to do read and write binary data, there is of course <Array::pack and String::unpack The packable library makes (un)packing nicer, smarter and more powerful.}
11
+ s.email = %q{github@marc-andre.ca}
12
+ s.extra_rdoc_files = [
13
+ "LICENSE",
14
+ "README.rdoc"
15
+ ]
16
+ s.files = [
17
+ ".gitignore",
18
+ "CHANGELOG.rdoc",
19
+ "LICENSE",
20
+ "README.rdoc",
21
+ "Rakefile",
22
+ "VERSION.yml",
23
+ "lib/packable.rb",
24
+ "lib/packable/extensions/array.rb",
25
+ "lib/packable/extensions/float.rb",
26
+ "lib/packable/extensions/integer.rb",
27
+ "lib/packable/extensions/io.rb",
28
+ "lib/packable/extensions/object.rb",
29
+ "lib/packable/extensions/proc.rb",
30
+ "lib/packable/extensions/string.rb",
31
+ "lib/packable/mixin.rb",
32
+ "lib/packable/packers.rb",
33
+ "packable.gemspec",
34
+ "test/packing_doc_test.rb",
35
+ "test/packing_test.rb",
36
+ "test/test_helper.rb"
37
+ ]
38
+ s.has_rdoc = true
39
+ s.homepage = %q{http://github.com/marcandre/packable}
40
+ s.rdoc_options = ["--charset=UTF-8", "--title", "Packable library", "--main", "README.rdoc", "--line-numbers", "--inline-source"]
41
+ s.require_paths = ["lib"]
42
+ s.rubyforge_project = %q{packable}
43
+ s.rubygems_version = %q{1.3.1}
44
+ s.summary = %q{Extensive packing and unpacking capabilities}
45
+ s.test_files = [
46
+ "test/packing_doc_test.rb",
47
+ "test/packing_test.rb",
48
+ "test/test_helper.rb"
49
+ ]
50
+
51
+ if s.respond_to? :specification_version then
52
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
53
+ s.specification_version = 2
54
+
55
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
56
+ s.add_runtime_dependency(%q<backports>, [">= 0"])
57
+ else
58
+ s.add_dependency(%q<backports>, [">= 0"])
59
+ end
60
+ else
61
+ s.add_dependency(%q<backports>, [">= 0"])
62
+ end
63
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marcandre-packable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Marc-Andr\xC3\xA9 Lafortune"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-08 00:00:00 -07:00
12
+ date: 2009-08-19 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,6 +32,7 @@ extra_rdoc_files:
32
32
  - LICENSE
33
33
  - README.rdoc
34
34
  files:
35
+ - .gitignore
35
36
  - CHANGELOG.rdoc
36
37
  - LICENSE
37
38
  - README.rdoc
@@ -47,11 +48,13 @@ files:
47
48
  - lib/packable/extensions/string.rb
48
49
  - lib/packable/mixin.rb
49
50
  - lib/packable/packers.rb
51
+ - packable.gemspec
50
52
  - test/packing_doc_test.rb
51
53
  - test/packing_test.rb
52
54
  - test/test_helper.rb
53
55
  has_rdoc: true
54
56
  homepage: http://github.com/marcandre/packable
57
+ licenses:
55
58
  post_install_message:
56
59
  rdoc_options:
57
60
  - --charset=UTF-8
@@ -77,8 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
80
  version:
78
81
  requirements: []
79
82
 
80
- rubyforge_project: marcandre
81
- rubygems_version: 1.2.0
83
+ rubyforge_project: packable
84
+ rubygems_version: 1.3.5
82
85
  signing_key:
83
86
  specification_version: 2
84
87
  summary: Extensive packing and unpacking capabilities