ruby-ole 1.2.11.2 → 1.2.11.3

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ == 1.2.11.3 / 2012-02-25
2
+
3
+ - Various fixes for ruby 1.9.3 - handle iconv deprecation and
4
+ fix FileTime.from_time (github #7, brawnski).
5
+ - Avoid constant redefinition warning in gemspec.
6
+
1
7
  == 1.2.11.2 / 2011-09-07
2
8
 
3
9
  - Remove empty dirents after constructing tree (fixes non-contiguous
@@ -786,8 +786,11 @@ module Ole # :nodoc:
786
786
  @name = name
787
787
  end
788
788
 
789
+ # needed to add reset of @name_lookup here. might be better to just
790
+ # remove this method as its only used in one place anyway.
789
791
  def children= children
790
792
  @children = []
793
+ @name_lookup = {}
791
794
  children.each { |child| self << child }
792
795
  end
793
796
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Ole # :nodoc:
4
4
  class Storage
5
- VERSION = '1.2.11.2'
5
+ VERSION = '1.2.11.3'
6
6
  end
7
7
  end
8
8
 
@@ -1,6 +1,5 @@
1
1
  # encoding: ASCII-8BIT
2
2
 
3
- require 'iconv'
4
3
  require 'date'
5
4
 
6
5
  require 'ole/base'
@@ -37,22 +36,53 @@ module Ole # :nodoc:
37
36
  end
38
37
  end
39
38
 
40
- # for VT_LPWSTR
41
- class Lpwstr < String
42
- FROM_UTF16 = Iconv.new 'utf-8', 'utf-16le'
43
- TO_UTF16 = Iconv.new 'utf-16le', 'utf-8'
39
+ if ''.respond_to? :encode
40
+ # NOTE: only here in the interim to preserve behaviour of
41
+ # FROM/TO_UTF16 constants for ruby-msg.
42
+ class Iconv # :nodoc:
43
+ def initialize(to, from)
44
+ @to, @from = to, from
45
+ end
44
46
 
45
- def self.load str
46
- new FROM_UTF16.iconv(str).chomp(0.chr)
47
+ def iconv(str)
48
+ str.encode(@to, @from)
49
+ end
47
50
  end
48
51
 
49
- def self.dump str
50
- # need to append nulls?
51
- data = TO_UTF16.iconv str
52
- # not sure if this is the recommended way to do it, but I want to treat
53
- # the resulting utf16 data as regular bytes, not characters.
54
- data.force_encoding Encoding::ASCII_8BIT if data.respond_to? :encoding
55
- data
52
+ # for VT_LPWSTR
53
+ class Lpwstr < String
54
+ FROM_UTF16 = Iconv.new 'utf-8', 'utf-16le'
55
+ TO_UTF16 = Iconv.new 'utf-16le', 'utf-8'
56
+
57
+ def self.load str
58
+ new str.encode(Encoding::UTF_8, Encoding::UTF_16LE).chomp(0.chr)
59
+ end
60
+
61
+ def self.dump str
62
+ # need to append nulls?
63
+ data = str.encode(Encoding::UTF_16LE)
64
+ # not sure if this is the recommended way to do it, but I want to treat
65
+ # the resulting utf16 data as regular bytes, not characters.
66
+ data.force_encoding Encoding::ASCII_8BIT
67
+ data
68
+ end
69
+ end
70
+ else
71
+ require 'iconv'
72
+
73
+ # for VT_LPWSTR
74
+ class Lpwstr < String
75
+ FROM_UTF16 = Iconv.new 'utf-8', 'utf-16le'
76
+ TO_UTF16 = Iconv.new 'utf-16le', 'utf-8'
77
+
78
+ def self.load str
79
+ new FROM_UTF16.iconv(str).chomp(0.chr)
80
+ end
81
+
82
+ def self.dump str
83
+ # need to append nulls?
84
+ TO_UTF16.iconv str
85
+ end
56
86
  end
57
87
  end
58
88
 
@@ -61,7 +91,7 @@ module Ole # :nodoc:
61
91
  SIZE = 8
62
92
 
63
93
  # DateTime.new is slow... faster version for FileTime
64
- def self.new year, month, day, hour=0, min=0, sec=0, usec=0
94
+ def self.new year, month, day, hour=0, min=0, sec=0
65
95
  # DateTime will remove leap and leap-leap seconds
66
96
  sec = 59 if sec > 59
67
97
  if month <= 2
@@ -79,7 +109,7 @@ module Ole # :nodoc:
79
109
  end if respond_to?(:new!) || respond_to?(:new0)
80
110
 
81
111
  def self.from_time time
82
- new(*(time.to_a[0, 6].reverse + [time.usec]))
112
+ new(*time.to_a[0, 6].reverse)
83
113
  end
84
114
 
85
115
  def self.now
data/ruby-ole.gemspec CHANGED
@@ -1,4 +1,5 @@
1
- Kernel.load File.dirname(__FILE__) + '/lib/ole/storage/version.rb'
1
+ $:.unshift (File.dirname(__FILE__) + '/lib')
2
+ require 'ole/storage/version'
2
3
 
3
4
  PKG_NAME = 'ruby-ole'
4
5
  PKG_VERSION = Ole::Storage::VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-ole
3
3
  version: !ruby/object:Gem::Version
4
- hash: 103
4
+ hash: 101
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
9
  - 11
10
- - 2
11
- version: 1.2.11.2
10
+ - 3
11
+ version: 1.2.11.3
12
12
  platform: ruby
13
13
  authors:
14
14
  - Charles Lowe
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-09-08 00:00:00 -04:00
19
+ date: 2012-02-25 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies: []
22
22