Module: PuppetLanguageServer::FacterHelper
- Defined in:
- lib/puppet-languageserver/facter_helper.rb
Class Method Summary collapse
-
.fact(session_state, name) ⇒ Object
Facts.
- .fact_names(session_state) ⇒ Object
- .fact_value(session_state, name) ⇒ Object
- .facts_to_hash(session_state) ⇒ Object
Class Method Details
.fact(session_state, name) ⇒ Object
Facts
6 7 8 |
# File 'lib/puppet-languageserver/facter_helper.rb', line 6 def self.fact(session_state, name) session_state.object_cache.object_by_name(:fact, name) end |
.fact_names(session_state) ⇒ Object
15 16 17 |
# File 'lib/puppet-languageserver/facter_helper.rb', line 15 def self.fact_names(session_state) session_state.object_cache.object_names_by_section(:fact).map(&:to_s) end |
.fact_value(session_state, name) ⇒ Object
10 11 12 13 |
# File 'lib/puppet-languageserver/facter_helper.rb', line 10 def self.fact_value(session_state, name) object = session_state.object_cache.object_by_name(:fact, name) object.nil? ? nil : object.value end |
.facts_to_hash(session_state) ⇒ Object
19 20 21 22 23 |
# File 'lib/puppet-languageserver/facter_helper.rb', line 19 def self.facts_to_hash(session_state) fact_hash = {} session_state.object_cache.objects_by_section(:fact) { |factname, fact| fact_hash[factname.to_s] = fact.value } fact_hash end |