ruby-msg 1.5.1 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/COPYING +20 -0
- data/ChangeLog +111 -0
- data/{README → README.rdoc} +4 -5
- data/Rakefile +29 -54
- data/bin/mapitool +1 -2
- data/lib/mapi/base.rb +104 -0
- data/lib/mapi/convert/note-mime.rb +2 -2
- data/lib/mapi/convert/note-tmail.rb +2 -2
- data/lib/{mime.rb → mapi/mime.rb} +0 -8
- data/lib/mapi/version.rb +3 -0
- data/lib/mapi.rb +3 -107
- data/ruby-msg.gemspec +35 -0
- data/test/test_mime.rb +2 -3
- metadata +70 -89
- data/FIXES +0 -56
- data/lib/orderedhash.rb +0 -218
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 94aa91f6a46340387923350f0eb5e758fd88ea6fe9042e2eeb3aa4e5830df910
|
4
|
+
data.tar.gz: d357f9db0d6af403d62f7707d82b70c6422ba18253335dce0f1c5b3a2ebefa9f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4b1f903559402d79634d44e2fe692ec4de5c106c059d6d402833cef0d51d5e12ffe5c1dcf57d0bd98461582b3129e2f3fc9d480f08ff11cb91b6388ec672f49d
|
7
|
+
data.tar.gz: a2ecce5b15c31678e1069d6482a75f73e168a16b71a2982f9d5c24b78ca8abf20015b8021584b02fd5294b07f9e1d87da12ce58166c05f014921f875b10eccc1
|
data/COPYING
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2007-2014 Charles Lowe
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
20
|
+
|
data/ChangeLog
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
== 1.5.3 / 2024-03-28
|
2
|
+
|
3
|
+
- Remove OrderedHash (github #12, mvz).
|
4
|
+
- Change project homepage to github and add .rdoc extension to README.
|
5
|
+
- Update wiki links in README to point to github not googlecode.
|
6
|
+
- Fix broken Attachment#save (github #14).
|
7
|
+
|
8
|
+
== 1.5.2 / 2014-08-20
|
9
|
+
|
10
|
+
- Move mime.rb file to avoid conflicts with mime_types gem (github #7,
|
11
|
+
blerins).
|
12
|
+
- Minor fix to mapitool for ruby >= 1.9.
|
13
|
+
- Alway require mapi/convert (indirect fix for missed step in README,
|
14
|
+
github #6).
|
15
|
+
- Various minor cleanups.
|
16
|
+
|
17
|
+
== 1.5.1 / 2012-07-03
|
18
|
+
|
19
|
+
- Fix handling of different body types (issue #14). Was breaking on
|
20
|
+
files without RTF content since 8933c26e, and also failing on files
|
21
|
+
where PR_BODY_HTML was a string rather than a stream.
|
22
|
+
- Move classes from RTF into Mapi::RTF (github #4).
|
23
|
+
|
24
|
+
== 1.5.0 / 2011-05-18
|
25
|
+
|
26
|
+
- Fixes for ruby 1.9.
|
27
|
+
- Move Mime into the Mapi module namespace (crowbot).
|
28
|
+
- Use ascii regex flag to avoid unicode probs (crowbot).
|
29
|
+
|
30
|
+
== 1.4.0 / 2008-10-12
|
31
|
+
|
32
|
+
- Initial simple msg test case.
|
33
|
+
- Update TODO, stripping out all the redundant ole stuff.
|
34
|
+
- Fix property set guids to use the new Ole::Types::Clsid type.
|
35
|
+
- Add block form of Msg.open
|
36
|
+
- Fix file requires for running tests individually.
|
37
|
+
- Update pst RangesIO subclasses for changes in ruby-ole.
|
38
|
+
- Merge initial pst reading code (converted from libpst).
|
39
|
+
- Pretty big pst refactoring, adding initial outlook 2003 pst support.
|
40
|
+
- Flesh out move to mapi to clean up the way pst hijacks the msg
|
41
|
+
classes currently.
|
42
|
+
- Add a ChangeLog :).
|
43
|
+
- Update README, by converting Home.wiki with wiki2rdoc converter.
|
44
|
+
- Separate out generic mapi object code from msg code, and separate out
|
45
|
+
conversion code.
|
46
|
+
- Add decent set of Mapi and Msg unit tests, approaching ~55% code coverage,
|
47
|
+
not including pst.
|
48
|
+
- Add TMail note conversion alternative, to eventually allow removal of
|
49
|
+
custom Mime class.
|
50
|
+
- Expose experimental pst support through renamed mapitool program.
|
51
|
+
|
52
|
+
== 1.3.1 / 2007-08-21
|
53
|
+
|
54
|
+
- Add fix for issue #2, and #4.
|
55
|
+
- Move ole code to ruby-ole project, and depend on it.
|
56
|
+
|
57
|
+
== 1.2.17 / 2007-05-13
|
58
|
+
|
59
|
+
(This was last release before splitting out ruby-ole. subsequent bug fix
|
60
|
+
point releases 1-3 were made directly on the gem, not reflected in the
|
61
|
+
repository, though the fixes were also forward-ported.)
|
62
|
+
|
63
|
+
- Update Ole::Storage backend, finalising api for split to separate
|
64
|
+
library.
|
65
|
+
|
66
|
+
== 1.2.16 / 2007-04-28
|
67
|
+
|
68
|
+
- Some minor fixes to msg parser.
|
69
|
+
- Extending RTF and body conversion support.
|
70
|
+
- Initial look at possible wmf conversion for embedded images.
|
71
|
+
- Add initial cli converter tool
|
72
|
+
- Add rdoc to ole/storage, and msg/properties
|
73
|
+
- Add streaming IO support to Ole::Storage, and use it in Msg::Properties
|
74
|
+
- Updates to test cases
|
75
|
+
- Add README, and update TODO
|
76
|
+
- Convert rtf support tools in c to small ruby class.
|
77
|
+
- Merge preliminary write support for Ole::Storage, as well as preliminary
|
78
|
+
filesystem api.
|
79
|
+
|
80
|
+
== 1.2.13 / 2007-01-22
|
81
|
+
|
82
|
+
- Nested msg support
|
83
|
+
|
84
|
+
== 1.2.10 / 2007-01-21
|
85
|
+
|
86
|
+
- Add initial vcard support.
|
87
|
+
- Implement a named properties map, for vcard conversion.
|
88
|
+
- Add orderedhash to Mime for keeping header order
|
89
|
+
- Fix line endings in lib/mime
|
90
|
+
- First released version
|
91
|
+
|
92
|
+
== <= 1.2.9 / 2007-01-11..2007-01-19
|
93
|
+
|
94
|
+
(Haven't bothered to note exact versions and dates - nothing here was released.
|
95
|
+
can look at history of lib/msg.rb to see exact VERSION at each commit.)
|
96
|
+
|
97
|
+
- Merged most of the named property work.
|
98
|
+
- Added some test files.
|
99
|
+
- Update svn:ignore, to exclude test messages and ole files which I can't
|
100
|
+
release. Need to get some clean files for use in test cases.
|
101
|
+
Also excluding source to the mapitags files for the moment.
|
102
|
+
A lot of it is not redistributable
|
103
|
+
- Added a converter to extract embedded html in rtf. Downloaded somewhere,
|
104
|
+
source unknown.
|
105
|
+
- Minor fix to ole/storage.rb, after new OleDir#type behaviour
|
106
|
+
- Imported support.rb, replacing previously required std.rb
|
107
|
+
- Added initial support for parsing times in Msg::Properties.
|
108
|
+
- Imported some rtf decompression code and minor updates.
|
109
|
+
- Cleaned up the ole class a bit
|
110
|
+
- Fixed OleDir#data method using sb_blocks map (see POLE).
|
111
|
+
|
data/{README → README.rdoc}
RENAMED
@@ -118,11 +118,10 @@ support conversion to mime objects.
|
|
118
118
|
|
119
119
|
For more information, see
|
120
120
|
|
121
|
-
* TODO
|
121
|
+
* TODO[/aquasync/ruby-msg/wiki/TODO]
|
122
122
|
|
123
|
-
* MsgDetails[
|
123
|
+
* MsgDetails[/aquasync/ruby-msg/wiki/MsgDetails]
|
124
124
|
|
125
|
-
* PstDetails[
|
126
|
-
|
127
|
-
* OleDetails[http://code.google.com/p/ruby-ole/wiki/OleDetails]
|
125
|
+
* PstDetails[/aquasync/ruby-msg/wiki/PstDetails]
|
128
126
|
|
127
|
+
* OleDetails[/aquasync/ruby-msg/wiki/OleDetails]
|
data/Rakefile
CHANGED
@@ -1,77 +1,52 @@
|
|
1
|
-
require '
|
1
|
+
require 'rubygems'
|
2
2
|
require 'rake/testtask'
|
3
|
-
require 'rake/packagetask'
|
4
|
-
require 'rake/gempackagetask'
|
5
3
|
|
6
4
|
require 'rbconfig'
|
7
5
|
require 'fileutils'
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
require 'mapi/msg'
|
12
|
-
|
13
|
-
PKG_NAME = 'ruby-msg'
|
14
|
-
PKG_VERSION = Mapi::VERSION
|
7
|
+
spec = eval File.read('ruby-msg.gemspec')
|
15
8
|
|
16
9
|
task :default => [:test]
|
17
10
|
|
18
|
-
Rake::TestTask.new
|
11
|
+
Rake::TestTask.new do |t|
|
19
12
|
t.test_files = FileList["test/test_*.rb"] - ['test/test_pst.rb']
|
20
13
|
t.warning = false
|
21
14
|
t.verbose = true
|
22
15
|
end
|
23
16
|
|
24
17
|
begin
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
Rcov::RcovTask.new do |t|
|
29
|
-
t.test_files = FileList['test/test*.rb']
|
30
|
-
t.ruby_opts << "-Ilib" # in order to use this rcov
|
31
|
-
t.rcov_opts << "--xrefs" # comment to disable cross-references
|
32
|
-
t.rcov_opts << "--exclude /usr/local/lib/site_ruby"
|
18
|
+
Rake::TestTask.new(:coverage) do |t|
|
19
|
+
t.test_files = FileList["test/test_*.rb"] - ['test/test_pst.rb']
|
20
|
+
t.warning = false
|
33
21
|
t.verbose = true
|
22
|
+
t.ruby_opts = ['-rsimplecov -e "SimpleCov.start; load(ARGV.shift)"']
|
34
23
|
end
|
35
24
|
rescue LoadError
|
36
|
-
#
|
37
|
-
end
|
38
|
-
|
39
|
-
Rake::RDocTask.new do |t|
|
40
|
-
t.rdoc_dir = 'doc'
|
41
|
-
t.title = "#{PKG_NAME} documentation"
|
42
|
-
t.options += %w[--main README --line-numbers --inline-source --tab-width 2]
|
43
|
-
t.rdoc_files.include 'lib/**/*.rb'
|
44
|
-
t.rdoc_files.include 'README'
|
25
|
+
# SimpleCov not available
|
45
26
|
end
|
46
27
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
s.files += FileList['lib/**/*.rb', 'test/test_*.rb', 'bin/*']
|
60
|
-
|
61
|
-
s.has_rdoc = true
|
62
|
-
s.extra_rdoc_files = ['README']
|
63
|
-
s.rdoc_options += ['--main', 'README',
|
64
|
-
'--title', "#{PKG_NAME} documentation",
|
65
|
-
'--tab-width', '2']
|
66
|
-
|
67
|
-
s.add_dependency 'ruby-ole', '>=1.2.8'
|
68
|
-
s.add_dependency 'vpim', '>=0.360'
|
28
|
+
begin
|
29
|
+
require 'rdoc/task'
|
30
|
+
RDoc::Task.new do |t|
|
31
|
+
t.rdoc_dir = 'doc'
|
32
|
+
t.rdoc_files.include 'lib/**/*.rb'
|
33
|
+
t.rdoc_files.include 'README', 'ChangeLog'
|
34
|
+
t.title = "#{PKG_NAME} documentation"
|
35
|
+
t.options += %w[--line-numbers --inline-source --tab-width 2]
|
36
|
+
t.main = 'README'
|
37
|
+
end
|
38
|
+
rescue LoadError
|
39
|
+
# RDoc not available or too old (<2.4.2)
|
69
40
|
end
|
70
41
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
42
|
+
begin
|
43
|
+
require 'rubygems/package_task'
|
44
|
+
Gem::PackageTask.new(spec) do |t|
|
45
|
+
t.need_tar = true
|
46
|
+
t.need_zip = false
|
47
|
+
t.package_dir = 'build'
|
48
|
+
end
|
49
|
+
rescue LoadError
|
50
|
+
# RubyGems too old (<1.3.2)
|
76
51
|
end
|
77
52
|
|
data/bin/mapitool
CHANGED
@@ -6,7 +6,6 @@ require 'optparse'
|
|
6
6
|
require 'rubygems'
|
7
7
|
require 'mapi/msg'
|
8
8
|
require 'mapi/pst'
|
9
|
-
require 'mapi/convert'
|
10
9
|
require 'time'
|
11
10
|
|
12
11
|
class Mapitool
|
@@ -107,7 +106,7 @@ class Mapitool
|
|
107
106
|
# is the only one that can be robuslty un-quoted. evolution doesn't use this!
|
108
107
|
f.puts "From mapitool@localhost #{Time.now.rfc2822}"
|
109
108
|
#munge_headers mime, opts
|
110
|
-
data.each do |line|
|
109
|
+
data.lines.each do |line|
|
111
110
|
if line =~ /^>*From /o
|
112
111
|
f.print '>' + line
|
113
112
|
else
|
data/lib/mapi/base.rb
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
module Mapi
|
2
|
+
#
|
3
|
+
# Mapi::Item is the base class used for all mapi objects, and is purely a
|
4
|
+
# property set container
|
5
|
+
#
|
6
|
+
class Item
|
7
|
+
attr_reader :properties
|
8
|
+
alias props properties
|
9
|
+
|
10
|
+
# +properties+ should be a PropertySet instance.
|
11
|
+
def initialize properties
|
12
|
+
@properties = properties
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# a general attachment class. is subclassed by Msg and Pst attachment classes
|
17
|
+
class Attachment < Item
|
18
|
+
def filename
|
19
|
+
props.attach_long_filename || props.attach_filename
|
20
|
+
end
|
21
|
+
|
22
|
+
def data
|
23
|
+
@embedded_msg || @embedded_ole || props.attach_data
|
24
|
+
end
|
25
|
+
|
26
|
+
# with new stream work, its possible to not have the whole thing in memory at one time,
|
27
|
+
# just to save an attachment
|
28
|
+
#
|
29
|
+
# a = msg.attachments.first
|
30
|
+
# a.save open(File.basename(a.filename || 'attachment'), 'wb')
|
31
|
+
def save io
|
32
|
+
raise "can only save binary data blobs, not ole dirs" if @embedded_ole
|
33
|
+
data.rewind
|
34
|
+
io << data.read(8192) until data.eof?
|
35
|
+
end
|
36
|
+
|
37
|
+
def inspect
|
38
|
+
"#<#{self.class.to_s[/\w+$/]}" +
|
39
|
+
(filename ? " filename=#{filename.inspect}" : '') +
|
40
|
+
(@embedded_ole ? " embedded_type=#{@embedded_ole.embedded_type.inspect}" : '') + ">"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class Recipient < Item
|
45
|
+
# some kind of best effort guess for converting to standard mime style format.
|
46
|
+
# there are some rules for encoding non 7bit stuff in mail headers. should obey
|
47
|
+
# that here, as these strings could be unicode
|
48
|
+
# email_address will be an EX:/ address (X.400?), unless external recipient. the
|
49
|
+
# other two we try first.
|
50
|
+
# consider using entry id for this too.
|
51
|
+
def name
|
52
|
+
name = props.transmittable_display_name || props.display_name
|
53
|
+
# dequote
|
54
|
+
name[/^'(.*)'/, 1] or name rescue nil
|
55
|
+
end
|
56
|
+
|
57
|
+
def email
|
58
|
+
props.smtp_address || props.org_email_addr || props.email_address
|
59
|
+
end
|
60
|
+
|
61
|
+
RECIPIENT_TYPES = { 0 => :orig, 1 => :to, 2 => :cc, 3 => :bcc }
|
62
|
+
def type
|
63
|
+
RECIPIENT_TYPES[props.recipient_type]
|
64
|
+
end
|
65
|
+
|
66
|
+
def to_s
|
67
|
+
if name = self.name and !name.empty? and email && name != email
|
68
|
+
%{"#{name}" <#{email}>}
|
69
|
+
else
|
70
|
+
email || name
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def inspect
|
75
|
+
"#<#{self.class.to_s[/\w+$/]}:#{self.to_s.inspect}>"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# i refer to it as a message (as does mapi), although perhaps Item is better, as its a more general
|
80
|
+
# concept than a message, as used in Pst files. though maybe i'll switch to using
|
81
|
+
# Mapi::Object as the base class there.
|
82
|
+
#
|
83
|
+
# IMessage essentially, but there's also stuff like IMAPIFolder etc. so, for this to form
|
84
|
+
# basis for PST Item, it'd need to be more general.
|
85
|
+
class Message < Item
|
86
|
+
# these 2 collections should be provided by our subclasses
|
87
|
+
def attachments
|
88
|
+
raise NotImplementedError
|
89
|
+
end
|
90
|
+
|
91
|
+
def recipients
|
92
|
+
raise NotImplementedError
|
93
|
+
end
|
94
|
+
|
95
|
+
def inspect
|
96
|
+
str = %w[message_class from to subject].map do |key|
|
97
|
+
" #{key}=#{props.send(key).inspect}"
|
98
|
+
end.compact.join
|
99
|
+
str << " recipients=#{recipients.inspect}"
|
100
|
+
str << " attachments=#{attachments.inspect}"
|
101
|
+
"#<#{self.class.to_s[/\w+$/]}#{str}>"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'base64'
|
2
|
-
require 'mime'
|
2
|
+
require 'mapi/mime'
|
3
3
|
require 'time'
|
4
4
|
|
5
5
|
# there is still some Msg specific stuff in here.
|
@@ -214,7 +214,7 @@ module Mapi
|
|
214
214
|
next if mime.headers.keys.map(&:downcase).include? key.downcase
|
215
215
|
mime.headers[key] += vals
|
216
216
|
end
|
217
|
-
# just a stupid hack to make the content-type header last
|
217
|
+
# just a stupid hack to make the content-type header last
|
218
218
|
mime.headers['Content-Type'] = mime.headers.delete 'Content-Type'
|
219
219
|
|
220
220
|
mime
|
@@ -3,7 +3,7 @@ require 'tmail'
|
|
3
3
|
|
4
4
|
# these will be removed later
|
5
5
|
require 'time'
|
6
|
-
require 'mime'
|
6
|
+
require 'mapi/mime'
|
7
7
|
|
8
8
|
# there is some Msg specific stuff in here.
|
9
9
|
|
@@ -226,7 +226,7 @@ module Mapi
|
|
226
226
|
#next if mime.headers.keys.map(&:downcase).include? key.downcase
|
227
227
|
mail[key] = vals.first
|
228
228
|
end
|
229
|
-
# just a stupid hack to make the content-type header last
|
229
|
+
# just a stupid hack to make the content-type header last
|
230
230
|
#mime.headers['Content-Type'] = mime.headers.delete 'Content-Type'
|
231
231
|
|
232
232
|
mail
|
@@ -13,7 +13,6 @@
|
|
13
13
|
# = TODO
|
14
14
|
#
|
15
15
|
# * Better streaming support, rather than an all-in-string approach.
|
16
|
-
# * Add +OrderedHash+ optionally, to not lose ordering in headers.
|
17
16
|
# * A fair bit remains to be done for this class, its fairly immature. But generally I'd like
|
18
17
|
# to see it be more generally useful.
|
19
18
|
# * All sorts of correctness issues, encoding particular.
|
@@ -23,13 +22,6 @@
|
|
23
22
|
#
|
24
23
|
module Mapi
|
25
24
|
class Mime
|
26
|
-
Hash = begin
|
27
|
-
require 'orderedhash'
|
28
|
-
OrderedHash
|
29
|
-
rescue LoadError
|
30
|
-
Hash
|
31
|
-
end
|
32
|
-
|
33
25
|
attr_reader :headers, :body, :parts, :content_type, :preamble, :epilogue
|
34
26
|
|
35
27
|
# Create a Mime object using +str+ as an initial serialization, which must contain headers
|
data/lib/mapi/version.rb
ADDED
data/lib/mapi.rb
CHANGED
@@ -1,109 +1,5 @@
|
|
1
|
+
require 'mapi/version'
|
2
|
+
require 'mapi/base'
|
1
3
|
require 'mapi/types'
|
2
4
|
require 'mapi/property_set'
|
3
|
-
|
4
|
-
module Mapi
|
5
|
-
VERSION = '1.5.1'
|
6
|
-
|
7
|
-
#
|
8
|
-
# Mapi::Item is the base class used for all mapi objects, and is purely a
|
9
|
-
# property set container
|
10
|
-
#
|
11
|
-
class Item
|
12
|
-
attr_reader :properties
|
13
|
-
alias props properties
|
14
|
-
|
15
|
-
# +properties+ should be a PropertySet instance.
|
16
|
-
def initialize properties
|
17
|
-
@properties = properties
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# a general attachment class. is subclassed by Msg and Pst attachment classes
|
22
|
-
class Attachment < Item
|
23
|
-
def filename
|
24
|
-
props.attach_long_filename || props.attach_filename
|
25
|
-
end
|
26
|
-
|
27
|
-
def data
|
28
|
-
@embedded_msg || @embedded_ole || props.attach_data
|
29
|
-
end
|
30
|
-
|
31
|
-
# with new stream work, its possible to not have the whole thing in memory at one time,
|
32
|
-
# just to save an attachment
|
33
|
-
#
|
34
|
-
# a = msg.attachments.first
|
35
|
-
# a.save open(File.basename(a.filename || 'attachment'), 'wb')
|
36
|
-
def save io
|
37
|
-
raise "can only save binary data blobs, not ole dirs" if @embedded_ole
|
38
|
-
data.each_read { |chunk| io << chunk }
|
39
|
-
end
|
40
|
-
|
41
|
-
def inspect
|
42
|
-
"#<#{self.class.to_s[/\w+$/]}" +
|
43
|
-
(filename ? " filename=#{filename.inspect}" : '') +
|
44
|
-
(@embedded_ole ? " embedded_type=#{@embedded_ole.embedded_type.inspect}" : '') + ">"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class Recipient < Item
|
49
|
-
# some kind of best effort guess for converting to standard mime style format.
|
50
|
-
# there are some rules for encoding non 7bit stuff in mail headers. should obey
|
51
|
-
# that here, as these strings could be unicode
|
52
|
-
# email_address will be an EX:/ address (X.400?), unless external recipient. the
|
53
|
-
# other two we try first.
|
54
|
-
# consider using entry id for this too.
|
55
|
-
def name
|
56
|
-
name = props.transmittable_display_name || props.display_name
|
57
|
-
# dequote
|
58
|
-
name[/^'(.*)'/, 1] or name rescue nil
|
59
|
-
end
|
60
|
-
|
61
|
-
def email
|
62
|
-
props.smtp_address || props.org_email_addr || props.email_address
|
63
|
-
end
|
64
|
-
|
65
|
-
RECIPIENT_TYPES = { 0 => :orig, 1 => :to, 2 => :cc, 3 => :bcc }
|
66
|
-
def type
|
67
|
-
RECIPIENT_TYPES[props.recipient_type]
|
68
|
-
end
|
69
|
-
|
70
|
-
def to_s
|
71
|
-
if name = self.name and !name.empty? and email && name != email
|
72
|
-
%{"#{name}" <#{email}>}
|
73
|
-
else
|
74
|
-
email || name
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def inspect
|
79
|
-
"#<#{self.class.to_s[/\w+$/]}:#{self.to_s.inspect}>"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# i refer to it as a message (as does mapi), although perhaps Item is better, as its a more general
|
84
|
-
# concept than a message, as used in Pst files. though maybe i'll switch to using
|
85
|
-
# Mapi::Object as the base class there.
|
86
|
-
#
|
87
|
-
# IMessage essentially, but there's also stuff like IMAPIFolder etc. so, for this to form
|
88
|
-
# basis for PST Item, it'd need to be more general.
|
89
|
-
class Message < Item
|
90
|
-
# these 2 collections should be provided by our subclasses
|
91
|
-
def attachments
|
92
|
-
raise NotImplementedError
|
93
|
-
end
|
94
|
-
|
95
|
-
def recipients
|
96
|
-
raise NotImplementedError
|
97
|
-
end
|
98
|
-
|
99
|
-
def inspect
|
100
|
-
str = %w[message_class from to subject].map do |key|
|
101
|
-
" #{key}=#{props.send(key).inspect}"
|
102
|
-
end.compact.join
|
103
|
-
str << " recipients=#{recipients.inspect}"
|
104
|
-
str << " attachments=#{attachments.inspect}"
|
105
|
-
"#<#{self.class.to_s[/\w+$/]}#{str}>"
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
5
|
+
require 'mapi/convert'
|
data/ruby-msg.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__) + '/lib'
|
2
|
+
require 'mapi/version'
|
3
|
+
|
4
|
+
PKG_NAME = 'ruby-msg'
|
5
|
+
PKG_VERSION = Mapi::VERSION
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = PKG_NAME
|
9
|
+
s.version = PKG_VERSION
|
10
|
+
s.summary = %q{Ruby Msg library.}
|
11
|
+
s.description = %q{A library for reading and converting Outlook msg and pst files (mapi message stores).}
|
12
|
+
s.authors = ['Charles Lowe']
|
13
|
+
s.email = %q{aquasync@gmail.com}
|
14
|
+
s.homepage = %q{https://github.com/aquasync/ruby-msg}
|
15
|
+
s.rubyforge_project = %q{ruby-msg}
|
16
|
+
|
17
|
+
s.executables = ['mapitool']
|
18
|
+
s.files = ['README.rdoc', 'COPYING', 'Rakefile', 'ChangeLog', 'ruby-msg.gemspec']
|
19
|
+
s.files += Dir.glob('data/*.yaml')
|
20
|
+
s.files += Dir.glob('lib/**/*.rb')
|
21
|
+
s.files += Dir.glob('test/test_*.rb')
|
22
|
+
s.files += Dir.glob('bin/*')
|
23
|
+
|
24
|
+
s.has_rdoc = true
|
25
|
+
s.extra_rdoc_files = ['README.rdoc', 'ChangeLog']
|
26
|
+
s.rdoc_options += [
|
27
|
+
'--main', 'README.rdoc',
|
28
|
+
'--title', "#{PKG_NAME} documentation",
|
29
|
+
'--tab-width', '2'
|
30
|
+
]
|
31
|
+
|
32
|
+
s.add_dependency 'ruby-ole', '>=1.2.8'
|
33
|
+
s.add_dependency 'vpim', '>=0.360'
|
34
|
+
end
|
35
|
+
|
data/test/test_mime.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
#! /usr/bin/ruby -w
|
2
2
|
|
3
|
-
|
4
|
-
$: << "#{TEST_DIR}/../lib"
|
3
|
+
$: << File.dirname(__FILE__) + '/../lib'
|
5
4
|
|
6
5
|
require 'test/unit'
|
7
|
-
require 'mime'
|
6
|
+
require 'mapi/mime'
|
8
7
|
|
9
8
|
class TestMime < Test::Unit::TestCase
|
10
9
|
# test out the way it partitions a message into parts
|
metadata
CHANGED
@@ -1,126 +1,107 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-msg
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: false
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 5
|
9
|
-
- 1
|
10
|
-
version: 1.5.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.5.3
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Charles Lowe
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2024-03-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
22
14
|
name: ruby-ole
|
23
|
-
|
24
|
-
|
25
|
-
none: false
|
26
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
27
17
|
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 15
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 2
|
33
|
-
- 8
|
18
|
+
- !ruby/object:Gem::Version
|
34
19
|
version: 1.2.8
|
35
20
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: vpim
|
39
21
|
prerelease: false
|
40
|
-
|
41
|
-
|
42
|
-
requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
43
24
|
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: vpim
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.360'
|
50
34
|
type: :runtime
|
51
|
-
|
52
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.360'
|
41
|
+
description: A library for reading and converting Outlook msg and pst files (mapi
|
42
|
+
message stores).
|
53
43
|
email: aquasync@gmail.com
|
54
|
-
executables:
|
44
|
+
executables:
|
55
45
|
- mapitool
|
56
46
|
extensions: []
|
57
|
-
|
58
|
-
|
59
|
-
-
|
60
|
-
files:
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
47
|
+
extra_rdoc_files:
|
48
|
+
- README.rdoc
|
49
|
+
- ChangeLog
|
50
|
+
files:
|
51
|
+
- COPYING
|
52
|
+
- ChangeLog
|
53
|
+
- README.rdoc
|
64
54
|
- Rakefile
|
65
|
-
- README
|
66
|
-
- FIXES
|
67
55
|
- bin/mapitool
|
56
|
+
- data/mapitags.yaml
|
57
|
+
- data/named_map.yaml
|
58
|
+
- data/types.yaml
|
68
59
|
- lib/mapi.rb
|
69
|
-
- lib/
|
70
|
-
- lib/
|
71
|
-
- lib/mapi/rtf.rb
|
72
|
-
- lib/mapi/property_set.rb
|
60
|
+
- lib/mapi/base.rb
|
61
|
+
- lib/mapi/convert.rb
|
73
62
|
- lib/mapi/convert/contact.rb
|
74
63
|
- lib/mapi/convert/note-mime.rb
|
75
64
|
- lib/mapi/convert/note-tmail.rb
|
65
|
+
- lib/mapi/mime.rb
|
66
|
+
- lib/mapi/msg.rb
|
67
|
+
- lib/mapi/property_set.rb
|
76
68
|
- lib/mapi/pst.rb
|
77
|
-
- lib/mapi/
|
69
|
+
- lib/mapi/rtf.rb
|
78
70
|
- lib/mapi/types.rb
|
79
|
-
- lib/mapi/
|
80
|
-
-
|
71
|
+
- lib/mapi/version.rb
|
72
|
+
- ruby-msg.gemspec
|
73
|
+
- test/test_convert_contact.rb
|
81
74
|
- test/test_convert_note.rb
|
82
75
|
- test/test_mime.rb
|
83
|
-
- test/test_convert_contact.rb
|
84
|
-
- test/test_types.rb
|
85
76
|
- test/test_msg.rb
|
86
|
-
|
87
|
-
|
77
|
+
- test/test_property_set.rb
|
78
|
+
- test/test_types.rb
|
79
|
+
homepage: https://github.com/aquasync/ruby-msg
|
88
80
|
licenses: []
|
89
|
-
|
81
|
+
metadata: {}
|
90
82
|
post_install_message:
|
91
|
-
rdoc_options:
|
92
|
-
- --main
|
93
|
-
- README
|
94
|
-
- --title
|
83
|
+
rdoc_options:
|
84
|
+
- "--main"
|
85
|
+
- README.rdoc
|
86
|
+
- "--title"
|
95
87
|
- ruby-msg documentation
|
96
|
-
- --tab-width
|
97
|
-
-
|
98
|
-
require_paths:
|
88
|
+
- "--tab-width"
|
89
|
+
- '2'
|
90
|
+
require_paths:
|
99
91
|
- lib
|
100
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
-
|
102
|
-
requirements:
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
103
94
|
- - ">="
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
version: "0"
|
109
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
|
-
requirements:
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
112
99
|
- - ">="
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
segments:
|
116
|
-
- 0
|
117
|
-
version: "0"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
118
102
|
requirements: []
|
119
|
-
|
120
|
-
rubyforge_project: ruby-msg
|
121
|
-
rubygems_version: 1.3.7
|
103
|
+
rubygems_version: 3.1.2
|
122
104
|
signing_key:
|
123
|
-
specification_version:
|
105
|
+
specification_version: 4
|
124
106
|
summary: Ruby Msg library.
|
125
107
|
test_files: []
|
126
|
-
|
data/FIXES
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
FIXES
|
2
|
-
|
3
|
-
recent fixes based on importing results into evolution
|
4
|
-
|
5
|
-
1. was running into some issue with base64 encoded message/rfc822 attachments displaying
|
6
|
-
as empty. encoding them as plain solved the issue (odd).
|
7
|
-
|
8
|
-
2. problem with a large percentage of emails, not displaying as mime. turned out to be
|
9
|
-
all received from blackberry. further, turned out there was 2 content-type headers,
|
10
|
-
"Content-Type", which I add, and "Content-type". normally my override works, but I
|
11
|
-
need to handle it case insensitvely it would appear. more tricky, whats the story
|
12
|
-
with these. fixing that will probably fix that whole class of issues there.
|
13
|
-
evolution was renaming my second content type as X-Invalid-Content-Type or something.
|
14
|
-
|
15
|
-
3. another interesting one. had content-transfer-encoding set in the transport message
|
16
|
-
headers. it was set to base64. i didn't override that, so evolution "decoded" my
|
17
|
-
plaintext message into complete garbage.
|
18
|
-
fix - delete content-transfer-encoding.
|
19
|
-
|
20
|
-
4. added content-location and content-id output in the mime handling of attachments
|
21
|
-
to get some inline html/image mails to work properly.
|
22
|
-
further, the containing mime content-type must be multipart/related, not multipart/mixed,
|
23
|
-
at least for evolution, in order for the images to appear inline.
|
24
|
-
could still improve in this area. if someone drags and drops in an image, it may
|
25
|
-
be inline in the rtf version, but exchanges generates crappy html such that the image
|
26
|
-
doesn't display inline. maybe i should correct the html output in these cases as i'm
|
27
|
-
throwing away the rtf version.
|
28
|
-
|
29
|
-
5. note you may need wingdings installed. i had a lot of L and J appear in messages from
|
30
|
-
outlook users. turns out its smilies in wingdings. i think its only if word is used
|
31
|
-
as email editor and has autotext messing things up.
|
32
|
-
|
33
|
-
6. still unsure about how to do my "\r" handling.
|
34
|
-
|
35
|
-
7. need to join addresses with , instead of ; i think. evolution only shows the
|
36
|
-
first one otherwise it appears, but all when they are , separated.
|
37
|
-
|
38
|
-
8. need to solve ole storage issues with the very large file using extra bat
|
39
|
-
stuff.
|
40
|
-
|
41
|
-
9. retest a bit on evolution and thunderbird, and release. tested on a corups
|
42
|
-
of >1000 msg files, so should be starting to get pretty good quality.
|
43
|
-
|
44
|
-
10. longer term, things fall into a few basic categories:
|
45
|
-
|
46
|
-
- non mail conversions (look further into vcard, ical et al support for other
|
47
|
-
types of msg)
|
48
|
-
- further tests and robustness for what i handle now. ie, look into corner
|
49
|
-
cases covered so far, and work on the mime code. fix random charset encoding
|
50
|
-
issues, in the various weird mime ways, do header wrapping etc etc.
|
51
|
-
check fidelity of conversions, and capture some more properties as headers,
|
52
|
-
such as importance which i don't do yet.
|
53
|
-
- fix that named property bug. tidy up warnings, exceptions.
|
54
|
-
- extend conversion to make better html.
|
55
|
-
this is longer term. as i don't use the rtf, i need to make my html better.
|
56
|
-
emulating some rtf things. harder, not important atm.
|
data/lib/orderedhash.rb
DELETED
@@ -1,218 +0,0 @@
|
|
1
|
-
# = OrderedHash
|
2
|
-
#
|
3
|
-
# == Version
|
4
|
-
# 1.2006.07.13 (change of the first number means Big Change)
|
5
|
-
#
|
6
|
-
# == Description
|
7
|
-
# Hash which preserves order of added items (like PHP array).
|
8
|
-
#
|
9
|
-
# == Usage
|
10
|
-
#
|
11
|
-
# (see examples directory under the ruby gems root directory)
|
12
|
-
#
|
13
|
-
# require 'rubygems'
|
14
|
-
# require 'ordered_hash'
|
15
|
-
#
|
16
|
-
# hsh = OrderedHash.new
|
17
|
-
# hsh['z'] = 1
|
18
|
-
# hsh['a'] = 2
|
19
|
-
# hsh['c'] = 3
|
20
|
-
# p hsh.keys # ['z','a','c']
|
21
|
-
#
|
22
|
-
# == Source
|
23
|
-
# http://simplypowerful.1984.cz/goodlibs/1.2006.07.13
|
24
|
-
#
|
25
|
-
# == Author
|
26
|
-
# jan molic (/mig/at_sign/1984/dot/cz/)
|
27
|
-
#
|
28
|
-
# == Thanks to
|
29
|
-
# Andrew Johnson for his suggestions and fixes of Hash[], merge, to_a, inspect and shift
|
30
|
-
# Desmond Dsouza for == fixes
|
31
|
-
#
|
32
|
-
# == Licence
|
33
|
-
# You can redistribute it and/or modify it under the same terms of Ruby's license;
|
34
|
-
# either the dual license version in 2003, or any later version.
|
35
|
-
#
|
36
|
-
|
37
|
-
class OrderedHash < Hash
|
38
|
-
|
39
|
-
attr_accessor :order
|
40
|
-
|
41
|
-
class << self
|
42
|
-
|
43
|
-
def [] *args
|
44
|
-
hsh = OrderedHash.new
|
45
|
-
if Hash === args[0]
|
46
|
-
hsh.replace args[0]
|
47
|
-
elsif (args.size % 2) != 0
|
48
|
-
raise ArgumentError, "odd number of elements for Hash"
|
49
|
-
else
|
50
|
-
hsh[args.shift] = args.shift while args.size > 0
|
51
|
-
end
|
52
|
-
hsh
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
def initialize(*a, &b)
|
58
|
-
super
|
59
|
-
@order = []
|
60
|
-
end
|
61
|
-
|
62
|
-
def store_only a,b
|
63
|
-
store a,b
|
64
|
-
end
|
65
|
-
|
66
|
-
alias orig_store store
|
67
|
-
|
68
|
-
def store a,b
|
69
|
-
@order.push a unless has_key? a
|
70
|
-
super a,b
|
71
|
-
end
|
72
|
-
|
73
|
-
alias []= store
|
74
|
-
|
75
|
-
def == hsh2
|
76
|
-
return hsh2==self if !hsh2.is_a?(OrderedHash)
|
77
|
-
return false if @order != hsh2.order
|
78
|
-
super hsh2
|
79
|
-
end
|
80
|
-
|
81
|
-
def clear
|
82
|
-
@order = []
|
83
|
-
super
|
84
|
-
end
|
85
|
-
|
86
|
-
def delete key
|
87
|
-
@order.delete key
|
88
|
-
super
|
89
|
-
end
|
90
|
-
|
91
|
-
def each_key
|
92
|
-
@order.each { |k| yield k }
|
93
|
-
self
|
94
|
-
end
|
95
|
-
|
96
|
-
def each_value
|
97
|
-
@order.each { |k| yield self[k] }
|
98
|
-
self
|
99
|
-
end
|
100
|
-
|
101
|
-
def each
|
102
|
-
@order.each { |k| yield k,self[k] }
|
103
|
-
self
|
104
|
-
end
|
105
|
-
|
106
|
-
alias each_pair each
|
107
|
-
|
108
|
-
def delete_if
|
109
|
-
@order.clone.each { |k|
|
110
|
-
delete k if yield
|
111
|
-
}
|
112
|
-
self
|
113
|
-
end
|
114
|
-
|
115
|
-
def values
|
116
|
-
ary = []
|
117
|
-
@order.each { |k| ary.push self[k] }
|
118
|
-
ary
|
119
|
-
end
|
120
|
-
|
121
|
-
def keys
|
122
|
-
@order
|
123
|
-
end
|
124
|
-
|
125
|
-
def invert
|
126
|
-
hsh2 = Hash.new
|
127
|
-
@order.each { |k| hsh2[self[k]] = k }
|
128
|
-
hsh2
|
129
|
-
end
|
130
|
-
|
131
|
-
def reject &block
|
132
|
-
self.dup.delete_if( &block )
|
133
|
-
end
|
134
|
-
|
135
|
-
def reject! &block
|
136
|
-
hsh2 = reject( &block )
|
137
|
-
self == hsh2 ? nil : hsh2
|
138
|
-
end
|
139
|
-
|
140
|
-
def replace hsh2
|
141
|
-
@order = hsh2.keys
|
142
|
-
super hsh2
|
143
|
-
end
|
144
|
-
|
145
|
-
def shift
|
146
|
-
key = @order.first
|
147
|
-
key ? [key,delete(key)] : super
|
148
|
-
end
|
149
|
-
|
150
|
-
def unshift k,v
|
151
|
-
unless self.include? k
|
152
|
-
@order.unshift k
|
153
|
-
orig_store(k,v)
|
154
|
-
true
|
155
|
-
else
|
156
|
-
false
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
def push k,v
|
161
|
-
unless self.include? k
|
162
|
-
@order.push k
|
163
|
-
orig_store(k,v)
|
164
|
-
true
|
165
|
-
else
|
166
|
-
false
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def pop
|
171
|
-
key = @order.last
|
172
|
-
key ? [key,delete(key)] : nil
|
173
|
-
end
|
174
|
-
|
175
|
-
def first
|
176
|
-
self[@order.first]
|
177
|
-
end
|
178
|
-
|
179
|
-
def last
|
180
|
-
self[@order.last]
|
181
|
-
end
|
182
|
-
|
183
|
-
def to_a
|
184
|
-
ary = []
|
185
|
-
each { |k,v| ary << [k,v] }
|
186
|
-
ary
|
187
|
-
end
|
188
|
-
|
189
|
-
def to_s
|
190
|
-
self.to_a.to_s
|
191
|
-
end
|
192
|
-
|
193
|
-
def inspect
|
194
|
-
ary = []
|
195
|
-
each {|k,v| ary << k.inspect + "=>" + v.inspect}
|
196
|
-
'{' + ary.join(", ") + '}'
|
197
|
-
end
|
198
|
-
|
199
|
-
def update hsh2
|
200
|
-
hsh2.each { |k,v| self[k] = v }
|
201
|
-
self
|
202
|
-
end
|
203
|
-
|
204
|
-
alias :merge! update
|
205
|
-
|
206
|
-
def merge hsh2
|
207
|
-
self.dup update(hsh2)
|
208
|
-
end
|
209
|
-
|
210
|
-
def select
|
211
|
-
ary = []
|
212
|
-
each { |k,v| ary << [k,v] if yield k,v }
|
213
|
-
ary
|
214
|
-
end
|
215
|
-
|
216
|
-
end
|
217
|
-
|
218
|
-
#=end
|