module Octofacts
Octofacts::Manipulators
- our fact manipulation API. Each method in Octofacts::Manipulators
will operate on one fact set at a time. These methods do not need to be aware of the existence of multiple fact sets.
Retrieves configuration parameters from:
- input hash - rspec configuration - environment
Constants
- VERSION
Public Class Methods
from_file(filename, opts = {})
click to toggle source
Octofacts.from_file
(filename, options) - Construct Octofacts::Facts
from a filename.
filename - Relative or absolute path to the file containing the facts. opts - Directory where fact fixture files are found (default: ENV)
Returns an Octofacts::Facts
object.
# File lib/octofacts/constructors/from_file.rb, line 8 def self.from_file(filename, opts = {}) unless filename.start_with? "/" dir = Octofacts::Util::Config.fetch(:octofacts_fixture_path, opts) raise ArgumentError, ".from_file needs to know :octofacts_fixture_path or environment OCTOFACTS_FIXTURE_PATH" unless dir raise Errno::ENOENT, "The provided fixture path #{dir} is invalid" unless File.directory?(dir) filename = File.join(dir, filename) end Octofacts::Facts.new(backend: Octofacts::Backends::YamlFile.new(filename), options: opts) end
from_index(opts = {})
click to toggle source
Octofacts.from_index(options)
- Construct Octofacts::Facts
from an index file.
Returns an Octofacts::Facts
object.
# File lib/octofacts/constructors/from_index.rb, line 5 def self.from_index(opts = {}) Octofacts::Facts.new(backend: Octofacts::Backends::Index.new(opts), options: opts) end