Make __profile_id private and add comment

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2019-11-06 11:16:40 -05:00
parent 11438d5d3c
commit bf5ce746c9

View file

@ -22,11 +22,6 @@ module Inspec
@action.call("describe.one", @checks, nil)
end
def __profile_id
# Excavate the profile ID. The action is a Method calling __add_check on a Rule whose profile ID we want
@action.receiver.instance_variable_get(:@__profile_id)
end
def input(input_name, options = {})
input_with_profile_id(__profile_id, input_name, options)
end
@ -42,5 +37,17 @@ module Inspec
def describe(*args, &block)
@checks.push(["describe", args, block])
end
private
# While this is marked private, it gets consumed during an instance_eval,
# so it is fully visible. The double underscore is there to discourage
# use - this is a private API.
def __profile_id
# Excavate the profile ID. The action is a Method calling __add_check on
# a Rule whose profile ID we want
@action.receiver.instance_variable_get(:@__profile_id)
end
end
end