Skip to content

Commit 88e737c

Browse files
committed
improve deprecated arg handling
1 parent 725715c commit 88e737c

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

lib/vips/image.rb

+2-6
Original file line numberDiff line numberDiff line change
@@ -1632,8 +1632,8 @@ def self.generate_operation introspect
16321632

16331633
method_args = introspect.method_args
16341634
required_output = introspect.required_output
1635-
optional_input = introspect.optional_input
1636-
optional_output = introspect.optional_output
1635+
optional_input = introspect.doc_optional_input
1636+
optional_output = introspect.doc_optional_output
16371637

16381638
print "# @!method "
16391639
print "self." unless introspect.member_x
@@ -1654,8 +1654,6 @@ def self.generate_operation introspect
16541654

16551655
puts "# @param opts [Hash] Set of options"
16561656
optional_input.each do |arg_name, details|
1657-
next if (details[:flags] & ARGUMENT_DEPRECATED) != 0
1658-
16591657
yard_name = details[:yard_name]
16601658
gtype = details[:gtype]
16611659
rtype = gtype_to_ruby gtype
@@ -1664,8 +1662,6 @@ def self.generate_operation introspect
16641662
puts "# @option opts [#{rtype}] :#{yard_name} #{blurb}"
16651663
end
16661664
optional_output.each do |arg_name, details|
1667-
next if (details[:flags] & ARGUMENT_DEPRECATED) != 0
1668-
16691665
yard_name = details[:yard_name]
16701666
gtype = details[:gtype]
16711667
rtype = gtype_to_ruby gtype

lib/vips/operation.rb

+15-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ module Vips
4848
class Introspect
4949
attr_reader :name, :description, :flags, :args, :required_input,
5050
:optional_input, :required_output, :optional_output, :member_x,
51-
:method_args, :vips_name, :destructive
51+
:method_args, :vips_name, :destructive, :doc_optional_input,
52+
:doc_optional_output
5253

5354
@@introspect_cache = {}
5455

@@ -142,6 +143,8 @@ def add_yard_introspection name
142143
@flags = Vips.vips_operation_get_flags @op
143144
@member_x = nil
144145
@method_args = []
146+
@doc_optional_input = {}
147+
@doc_optional_output = {}
145148

146149
@args.each do |details|
147150
arg_name = details[:arg_name]
@@ -164,6 +167,17 @@ def add_yard_introspection name
164167
end
165168
end
166169
end
170+
171+
# and make the arg sets to document by filtering out deprecated args
172+
@optional_input.each do |arg_name, details|
173+
next if (details[:flags] & ARGUMENT_DEPRECATED) != 0
174+
@doc_optional_input[details[:arg_name]] = details
175+
end
176+
177+
@optional_output.each do |arg_name, details|
178+
next if (details[:flags] & ARGUMENT_DEPRECATED) != 0
179+
@doc_optional_output[details[:arg_name]] = details
180+
end
167181
end
168182

169183
def self.get name

0 commit comments

Comments
 (0)