class Inspec::Input::Event
TODO: break this out to its own file under inspec/input? Information about how the input obtained its value. Each time it changes, an Input::Event
is added to the events array.
Constants
- EVENT_PROPERTIES
Attributes
value[R]
Public Class Methods
new(properties = {})
click to toggle source
# File lib/inspec/input.rb, line 62 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
probe_stack()
click to toggle source
# File lib/inspec/input.rb, line 94 def self.probe_stack frames = caller_locations(2, 40) frames.reject! { |f| f.path && f.path.include?("/lib/inspec/") } frames.first end
Public Instance Methods
diagnostic_string()
click to toggle source
# File lib/inspec/input.rb, line 84 def diagnostic_string to_h.reject { |_, val| val.nil? }.to_a.map { |pair| "#{pair[0]}: '#{pair[1]}'" }.join(", ") end
to_h()
click to toggle source
# File lib/inspec/input.rb, line 88 def to_h EVENT_PROPERTIES.each_with_object({}) do |prop, hash| hash[prop] = send(prop) end end
value=(the_val)
click to toggle source
# File lib/inspec/input.rb, line 74 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
value_has_been_set?()
click to toggle source
# File lib/inspec/input.rb, line 80 def value_has_been_set? @value_has_been_set end