Sha256: 4cf742277401542d019cbe83b949ea9359efec15fb6416c25155910c31233ddf

Contents?: true

Size: 577 Bytes

Versions: 4

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true

module Facter
  class ResolvedFact
    attr_reader :name, :type
    attr_accessor :user_query, :filter_tokens, :value

    def initialize(name, value = '', type = :core)
      unless type =~ /core|legacy|custom/
        raise ArgumentError, 'The type provided for fact is not legacy, core or custom!'
      end

      @name = name
      @value = Utils.deep_stringify_keys(value)
      @type = type
    end

    def legacy?
      type == :legacy
    end

    def core?
      type == :core
    end

    def to_s
      @value.to_s
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facter-4.0.18 lib/models/resolved_fact.rb
facter-4.0.17 lib/models/resolved_fact.rb
facter-4.0.16 lib/models/resolved_fact.rb
facter-4.0.15 lib/models/resolved_fact.rb