Skip to content
Browse files

Embed PropertySet meta data GUIDs and field lists.

* Avoids hitting filesystem on 'require'-ing the library, simplifying
  use embedded in jars, with exerb etc.
* Removes fairly unnecessary dependency on YAML for infrequently
  used code paths.
  • Loading branch information...
1 parent 212f757 commit 4d2e5ec52c8a28b872fdd1c401c84f2042fe777f @aquasync committed Feb 27, 2012
Showing with 40 additions and 61 deletions.
  1. +0 −56 data/propids.yaml
  2. +39 −4 lib/ole/types/property_set.rb
  3. +1 −1 ruby-ole.gemspec
View
56 data/propids.yaml
@@ -1,56 +0,0 @@
-"{f29f85e0-4ff9-1068-ab91-08002b27b3d9}":
- - FMTID_SummaryInformation
- - 2: doc_title
- 3: doc_subject
- 4: doc_author
- 5: doc_keywords
- 6: doc_comments
- 7: doc_template
- 8: doc_last_author
- 9: doc_rev_number
- 10: doc_edit_time
- 11: doc_last_printed
- 12: doc_created_time
- 13: doc_last_saved_time
- 14: doc_page_count
- 15: doc_word_count
- 16: doc_char_count
- 18: doc_app_name
- 19: security
-
-"{d5cdd502-2e9c-101b-9397-08002b2cf9ae}":
- - FMTID_DocSummaryInfo
- - 2: doc_category
- 3: doc_presentation_target
- 4: doc_byte_count
- 5: doc_line_count
- 6: doc_para_count
- 7: doc_slide_count
- 8: doc_note_count
- 9: doc_hidden_count
- 10: mmclips
- 11: scale_crop
- 12: heading_pairs
- 13: doc_part_titles
- 14: doc_manager
- 15: doc_company
- 16: links_up_to_date
-
-"{d5cdd505-2e9c-101b-9397-08002b2cf9ae}":
- - FMTID_UserDefinedProperties
- - {}
-
-# just dumped these all here. if i can confirm any of these
-# better, i can update this file so they're recognized.
-#0b63e343-9ccc-11d0-bcdb-00805fccce04
-#0b63e350-9ccc-11d0-bcdb-00805fccce04 NetLibrary propset?
-#31f400a0-fd07-11cf-b9bd-00aa003db18e ScriptInfo propset?
-#49691c90-7e17-101a-a91c-08002b2ecda9 Query propset?
-#560c36c0-503a-11cf-baa1-00004c752a9a
-#70eb7a10-55d9-11cf-b75b-00aa0051fe20 HTMLInfo propset
-#85ac0960-1819-11d1-896f-00805f053bab message propset?
-#aa568eec-e0e5-11cf-8fda-00aa00a14f93 NNTP SummaryInformation propset?
-#b725f130-47ef-101a-a5f1-02608c9eebac Storage propset
-#c82bf596-b831-11d0-b733-00aa00a1ebd2 NetLibraryInfo propset
-#c82bf597-b831-11d0-b733-00aa00a1ebd2 LinkInformation propset?
-#d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 LinkInformation propset?
View
43 lib/ole/types/property_set.rb
@@ -1,7 +1,5 @@
# encoding: ASCII-8BIT
-require 'yaml'
-
module Ole
module Types
#
@@ -24,8 +22,45 @@ class PropertySet
}
# define a smattering of the property set guids.
- DATA = YAML.load_file(File.dirname(__FILE__) + '/../../../data/propids.yaml').
- inject({}) { |hash, (key, value)| hash.update Clsid.parse(key) => value }
+ DATA = {
+ Clsid.parse('{f29f85e0-4ff9-1068-ab91-08002b27b3d9}') => ['FMTID_SummaryInformation', {
+ 2 => 'doc_title',
+ 3 => 'doc_subject',
+ 4 => 'doc_author',
+ 5 => 'doc_keywords',
+ 6 => 'doc_comments',
+ 7 => 'doc_template',
+ 8 => 'doc_last_author',
+ 9 => 'doc_rev_number',
+ 10 => 'doc_edit_time',
+ 11 => 'doc_last_printed',
+ 12 => 'doc_created_time',
+ 13 => 'doc_last_saved_time',
+ 14 => 'doc_page_count',
+ 15 => 'doc_word_count',
+ 16 => 'doc_char_count',
+ 18 => 'doc_app_name',
+ 19 => 'security'
+ }],
+ Clsid.parse('{d5cdd502-2e9c-101b-9397-08002b2cf9ae}') => ['FMTID_DocSummaryInfo', {
+ 2 => 'doc_category',
+ 3 => 'doc_presentation_target',
+ 4 => 'doc_byte_count',
+ 5 => 'doc_line_count',
+ 6 => 'doc_para_count',
+ 7 => 'doc_slide_count',
+ 8 => 'doc_note_count',
+ 9 => 'doc_hidden_count',
+ 10 => 'mmclips',
+ 11 => 'scale_crop',
+ 12 => 'heading_pairs',
+ 13 => 'doc_part_titles',
+ 14 => 'doc_manager',
+ 15 => 'doc_company',
+ 16 => 'links_up_to_date'
+ }],
+ Clsid.parse('{d5cdd505-2e9c-101b-9397-08002b2cf9ae}') => ['FMTID_UserDefinedProperties', {}]
+ }
# create an inverted map of names to guid/key pairs
PROPERTY_MAP = DATA.inject({}) do |h1, (guid, data)|
View
2 ruby-ole.gemspec
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
s.rubyforge_project = %q{ruby-ole}
s.executables = ['oletool']
- s.files = ['README', 'COPYING', 'Rakefile', 'ChangeLog', 'ruby-ole.gemspec', 'data/propids.yaml']
+ s.files = ['README', 'COPYING', 'Rakefile', 'ChangeLog', 'ruby-ole.gemspec']
s.files += Dir.glob('lib/**/*.rb')
s.files += Dir.glob('test/{test_*.rb,*.doc,oleWithDirs.ole,test_SummaryInformation}')
s.files += Dir.glob('bin/*')

0 comments on commit 4d2e5ec

Please sign in to comment.
Something went wrong with that request. Please try again.