class Inspec::Input::Event
Each time it changes, an Input::Event is added to the #events array.
Information about how the input obtained its value.
TODO: break this out to its own file under inspec/input?
def self.probe_stack
def self.probe_stack frames = caller_locations(2, 40) frames.reject! { |f| f.path && f.path.include?("/lib/inspec/") } frames.first end
def diagnostic_string
def diagnostic_string to_h.reject { |_, val| val.nil? }.to_a.map { |pair| "#{pair[0]}: '#{pair[1]}'" }.join(", ") end
def initialize(properties = {})
def initialize(properties = {}) @value_has_been_set = false properties.each do |prop_name, prop_value| if EVENT_PROPERTIES.include? prop_name # OK, save the property send((prop_name.to_s + "=").to_sym, prop_value) else raise "Unrecognized property to Input::Event: #{prop_name}" end end end
def to_h
def to_h EVENT_PROPERTIES.each_with_object({}) do |prop, hash| hash[prop] = send(prop) end end
def value=(the_val)
def value=(the_val) # Even if set to nil or false, it has indeed been set; note that fact. @value_has_been_set = true @value = the_val end
def value_has_been_set?
def value_has_been_set? @value_has_been_set end