Class: Facter::ResolvedFact

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/models/resolved_fact.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value = '', type = :core, user_query = nil) ⇒ ResolvedFact

Returns a new instance of ResolvedFact.



8
9
10
11
12
13
# File 'lib/facter/models/resolved_fact.rb', line 8

def initialize(name, value = '', type = :core, user_query = nil)
  @name = name
  @value = Utils.deep_stringify_keys(value)
  @type = type
  @user_query = user_query
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



6
7
8
# File 'lib/facter/models/resolved_fact.rb', line 6

def file
  @file
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/facter/models/resolved_fact.rb', line 5

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/facter/models/resolved_fact.rb', line 5

def type
  @type
end

#user_queryObject

Returns the value of attribute user_query.



6
7
8
# File 'lib/facter/models/resolved_fact.rb', line 6

def user_query
  @user_query
end

#valueObject

Returns the value of attribute value.



6
7
8
# File 'lib/facter/models/resolved_fact.rb', line 6

def value
  @value
end

Instance Method Details

#core?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/facter/models/resolved_fact.rb', line 19

def core?
  type == :core
end

#legacy?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/facter/models/resolved_fact.rb', line 15

def legacy?
  type == :legacy
end

#resolves?(user_query) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/facter/models/resolved_fact.rb', line 27

def resolves?(user_query)
  @name == user_query
end

#to_sObject



23
24
25
# File 'lib/facter/models/resolved_fact.rb', line 23

def to_s
  @value.to_s
end