lib/octofacts_updater/fixture.rb
# Get fact names associated with a particular data structure. Implements:
# - Default behavior, where YAML key = fact name
# - Regexp behavior, where YAML "regexp" key is used to match against all facts
# - Override behavior, where YAML "fact" key overrides whatever is in the tag
#
# fact_tag - A String with the YAML key
# args     - A Hash with the arguments
#
# Returns an Array of Strings with all fact names matched.
Get fact names associated with a particular data structure. Implements:
Default behavior, where YAML key = fact name
Regexp behavior, where YAML "regexp" key is used to match against all facts
Override behavior, where YAML "fact" key overrides whatever is in the tag

A String with the YAML key
args     - A Hash with the arguments

Returns an Array of Strings with all fact names matched.
Get fact names associated with a particular data structure . Implements : Default behavior where YAML key = fact name Regexp behavior where YAML " regexp " key is used to match against all facts Override behavior where YAML " fact " key overrides whatever is in the tag A String with the YAML key args - A Hash with the arguments Returns an Array of Strings with all fact names matched .
def fact_names(fact_tag, args = {})
      return [args["fact"]] if args.key?("fact")
      return [fact_tag] unless args.key?("regexp")
      rexp = Regexp.new(args["regexp"])
      @facts.keys.select { |k| rexp.match(k) }
    end
def fact_names ( fact_tag , args = { } ) return [ args [ "fact" ] ] if args . key? ( "fact" ) return [ fact_tag ] unless args . key? ( "regexp" ) rexp = Regexp . new ( args [ "regexp" ] ) @facts . keys . select { | k | rexp . match ( k ) } end
Get fact names associated with a particular data structure.
Get fact names associated with a particular data structure .
fact_tag
<not_specific>
args
<not_specific>