Skip to content

Commit c53572a

Browse files
committed
Export the callbacks
1 parent d8182b6 commit c53572a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/docurium.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def initialize(config_file, repo = nil)
2727
end
2828

2929
def init_data(version = 'HEAD')
30-
data = {:files => [], :functions => {}, :globals => {}, :types => {}, :prefix => ''}
30+
data = {:files => [], :functions => {}, :callbacks => {}, :globals => {}, :types => {}, :prefix => ''}
3131
data[:prefix] = option_version(version, 'input', '')
3232
data
3333
end
@@ -389,8 +389,9 @@ def update_globals!(data, recs)
389389

390390
# process this type of record
391391
case r[:type]
392-
when :function
393-
data[:functions][r[:name]] ||= {}
392+
when :function, :callback
393+
t = r[:type] == :function ? :functions : :callbacks
394+
data[t][r[:name]] ||= {}
394395
wanted[:functions].each do |k|
395396
next unless r.has_key? k
396397
conents = nil
@@ -399,7 +400,7 @@ def update_globals!(data, recs)
399400
else
400401
contents = r[k]
401402
end
402-
data[:functions][r[:name]][k] = contents
403+
data[t][r[:name]][k] = contents
403404
end
404405
file_map[r[:file]][:functions] << r[:name]
405406

test/repo_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ def test_can_store_mutliple_enum_doc_sections
129129

130130
def test_can_parse_callback
131131
cb = @data[:callbacks]['git_callback_do_work']
132-
assert_equal 'int', cb[:return][:type]
133-
132+
# we can mostly assume that the rest works as it's the same as for the functions
133+
assert_equal 'int', cb[:return][:type]
134134
end
135135

136136
end

0 commit comments

Comments
 (0)