apple-data 1.0.651 → 1.0.653

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0c08f469c75dfae827884566fe4ce755af8498b7796c3386fa480a069146ac0
4
- data.tar.gz: 4a024ac00342adc29f4a51e9db9e8db1569873e619cefd72801fc712c8b5e91d
3
+ metadata.gz: 482821ec962f4b074c21d5f0af855bb40a9c184abc02896489e825a882bafb65
4
+ data.tar.gz: d0f6b9232b2be836b4062ac088e75725437f703b093e7a511f1a9d9cc1c13e6e
5
5
  SHA512:
6
- metadata.gz: c7b8ff4a5926f27d734326b1c824036038b74480852033d7a44de883456c87ef49e4d4833c4942bfab685e42d9aaff349ee03c46ad8961f88bc3d39d6542fed0
7
- data.tar.gz: 06c32e5eb6fa6ac49a7711381bd6269e032f53f3abb82acd83c29f564c797dedb0cab57c71fc0c6a3b4a8019f543f198aa4806b5fb60b18931c6bfb0a28ab619
6
+ metadata.gz: ce1b5bcdfc7b2484efe583a56d171dd2ef7b9c71774e60d51cdc08fae9e8c8cb7f14279f26f195d0a646643e5b0324ad8c6c569f6f1a69bc42c27283105043bb
7
+ data.tar.gz: f2d9137bbafb0ff882773a591bc98c73bfe4459a4933b3da1c70c0e7b36be78aad5219ec51197e7bfef16322a8c6f35ee9f7ae6f79c57c70a907298d0882567a
@@ -159,7 +159,7 @@ module AppleData
159
159
  [key, instance]
160
160
  end
161
161
 
162
- result.to_h
162
+ result.to_h.with_indifferent_access
163
163
  end
164
164
  end
165
165
  end
@@ -6,15 +6,28 @@ module AppleData
6
6
  class DataFileDefinition
7
7
  def initialize
8
8
  @collections = {}
9
+ @methods = {}
9
10
  end
10
11
 
11
- def collection(name, mapper = nil, &)
12
- @collections[name] = AppleData::DSL::CollectionDefinition.new(name, mapper)
13
- if block_given? && @collections[name].mapper.nil?
14
- @collections[name].mapper = Class.new(AppleData::SchemaBase)
15
- @collections[name].mapper.class_eval(&)
12
+ def collection(collection_name, mapper = nil, &)
13
+ data_collection_name = self.class.name
14
+ @collections[collection_name] = AppleData::DSL::CollectionDefinition.new(collection_name, mapper)
15
+ if block_given? && @collections[collection_name].mapper.nil?
16
+ @collections[collection_name].mapper = Class.new(AppleData::SchemaBase)
17
+ @collections[collection_name].mapper.const_set(:DATA_COLLECTION_NAME, data_collection_name)
18
+ @collections[collection_name].mapper.const_set(:COLLECTION_NAME, collection_name)
19
+ @collections[collection_name].mapper.instance_eval do
20
+ def name
21
+ "#{self.class.const_get(:DATA_COLLECTION_NAME)}:#{self.class.const_get(:COLLECTION_NAME)}"
22
+ end
23
+ end
24
+ @collections[collection_name].mapper.class_eval(&)
16
25
  end
17
- @collections[name]
26
+ @collections[collection_name]
27
+ end
28
+
29
+ def define_method(name, &proc)
30
+ @methods[name] = proc
18
31
  end
19
32
 
20
33
  attr_writer :default_filename
@@ -29,6 +42,10 @@ module AppleData
29
42
  collection_definition.build!(klass)
30
43
  end
31
44
 
45
+ @methods.each do |name, proc|
46
+ klass.define_method(name, &proc)
47
+ end
48
+
32
49
  klass
33
50
  end
34
51
  end
@@ -16,4 +16,9 @@ AppleData::Schemas::IMG4 = AppleData::DataFile.define do
16
16
  collection :types do
17
17
  attribute :description, :string
18
18
  end
19
+
20
+ define_method :all do
21
+ [img4_tags, manifest_properties, objects, lpol_properties, core, types,
22
+ cryptex_properties].reduce(&:merge).with_indifferent_access
23
+ end
19
24
  end
@@ -15,6 +15,9 @@ AppleData::Schemas::PKI = AppleData::DataFile.define do
15
15
  end
16
16
 
17
17
  collection :oids do
18
+ attr_accessor :key
19
+
20
+ attribute :name, :string
18
21
  attribute :title, :string
19
22
  attribute :type, :string
20
23
  attribute :description, :string
@@ -22,5 +25,9 @@ AppleData::Schemas::PKI = AppleData::DataFile.define do
22
25
  attribute :found_in, :string, collection: true
23
26
  attribute :issuers, :string, collection: true
24
27
  attribute :ous, :string, collection: true
28
+
29
+ define_method :to_s do
30
+ [name, title, description, key].reject(&:blank?).first
31
+ end
25
32
  end
26
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppleData
4
- VERSION = '1.0.651'
4
+ VERSION = '1.0.653'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apple-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.651
4
+ version: 1.0.653
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Mark