Sha256: ebc6e80b4ca8cea099cdb1b76ea694e4f824a12e676ca9f8622fc677bd460e5e

Contents?: true

Size: 1.75 KB

Versions: 16

Compression:

Stored size: 1.75 KB

Contents

/**
 * @file
 * Declares the class for Ruby fact confines.
 */
#pragma once

#include <leatherman/ruby/api.hpp>
#include <string>
#include <vector>

namespace facter { namespace ruby {

    struct module;

    /**
     * Represents a Ruby API confine.
     */
    struct confine
    {
        /**
         * Confines a fact resolution based on a fact name and vector of expected values.
         * @param fact The fact name to confine to.  Can be nil if a block is given.
         * @param expected The expected value or values for the given fact.  Can be nil if no fact given.
         * @param block The block to call for the confine.  Can be nil.
         */
        confine(leatherman::ruby::VALUE fact, leatherman::ruby::VALUE expected, leatherman::ruby::VALUE block);

        /**
         * Moves the given confine into this confine.
         * @param other The confine to move into this confine.
         */
        confine(confine&& other);

        /**
         * Moves the given confine into this confine.
         * @param other The confine to move into this confine.
         * @return Returns this confine.
         */
        confine& operator=(confine&& other);

        /**
         * Determines if the confine is suitable or not.
         * @param facter The Ruby Facter module to resolve facts with.
         * @return Returns true if the confine is suitable or false if it is not.
         */
        bool suitable(module& facter) const;

     private:
        confine(confine const&) = delete;
        confine& operator=(confine const&) = delete;
        void mark() const;

        friend struct resolution;

        leatherman::ruby::VALUE _fact;
        leatherman::ruby::VALUE _expected;
        leatherman::ruby::VALUE _block;
    };

}}  // namespace facter::ruby

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
facter-3.12.2.cfacter.20181217 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.12.1.cfacter.20181031 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.11.6.cfacter.20181031 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.12.1.cfacter.20181023 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.11.5.cfacter.20181022 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.12.0.cfacter.20181004 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.12.0.cfacter.20181001 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.12.0.cfacter.20180918 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.11.4.cfacter.20180821 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.11.3.cfacter.20180716 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.11.2.cfacter.20180612 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.9.6.cfacter.20180612 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.11.2.cfacter.20180606 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.9.6.cfacter.20180606 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
facter-3.11.0.cfacter.20180319 ext/facter/facter/lib/inc/internal/ruby/confine.hpp
cfacter-3.11.0.rc.20180314 ext/facter/facter/lib/inc/internal/ruby/confine.hpp