Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/apple-knowledge.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/AppleData_Specs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion _packages/ruby/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ OUTPUT_PATH = Pathutil.new OUTPUT_ROOT

desc 'set the version patch to the git main height'
task :version do
repo_height = `git rev-list --count HEAD`
repo_height = `git rev-list --count main`
repo_height = '0' if repo_height.empty?

version_file = %(# frozen_string_literal: true
Expand Down
9 changes: 9 additions & 0 deletions _packages/ruby/lib/apple_data/dsl/data_file_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module DSL
class DataFileDefinition
def initialize
@collections = {}
@methods = {}
end

def collection(name, mapper = nil, &)
Expand All @@ -17,6 +18,10 @@ def collection(name, mapper = nil, &)
@collections[name]
end

def define_method(name, &proc)
@methods[name] = proc
end

attr_writer :default_filename

def build!
Expand All @@ -29,6 +34,10 @@ def build!
collection_definition.build!(klass)
end

@methods.each do |name, proc|
klass.define_method(name, &proc)
end

klass
end
end
Expand Down
5 changes: 5 additions & 0 deletions _packages/ruby/lib/apple_data/schemas/img4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@
collection :types do
attribute :description, :string
end

define_method :all do
[img4_tags, manifest_properties, objects, lpol_properties, core, types,
cryptex_properties].reduce(&:merge).with_indifferent_access
end
Comment on lines +20 to +23
end
7 changes: 7 additions & 0 deletions spec/apple_data/schemas/img4_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,11 @@
expect(instance.lpol_properties.values.compact).to all(be_a(AppleData::Models::IMG4::Property))
end
end

it 'has #all' do
aggregate_failures do
expect(instance.all).to be_a(Hash)
expect(instance.all).not_to be_empty
end
end
Comment on lines +48 to +53
end
Loading