Class: QB::Ansible::Env
- Inherits:
-
Object
- Object
- QB::Ansible::Env
- Defined in:
- lib/qb/ansible/env.rb
Overview
TODO:
document QB::Ansible::Env class.
Constant Summary collapse
- VAR_NAME_PREFIX =
Constants
'ANSIBLE'
Instance Attribute Summary collapse
-
#filter_plugins ⇒ Object
readonly
Returns the value of attribute filter_plugins.
-
#library ⇒ Object
readonly
Returns the value of attribute library.
-
#lookup_plugins ⇒ Object
readonly
Returns the value of attribute lookup_plugins.
-
#roles_path ⇒ Object
readonly
Returns the value of attribute roles_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Env
constructor
Instantiate a new
QB::Ansible::Env. - #to_h ⇒ return_type
Constructor Details
#initialize ⇒ Env
Instantiate a new QB::Ansible::Env.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/qb/ansible/env.rb', line 60 def initialize # NOTE this includes role paths pulled from a call-site local # ansible.cfg @roles_path = QB::Role.search_path. # since QB::Role.search_path is an Array select(&:directory?). map(&:realpath). # so uniq works uniq # drop dups (seems to keep first instance so preserves priority) @library = [ QB::ROOT.join('library'), ] @filter_plugins = [ QB::ROOT.join('plugins', 'filter_plugins'), ] @lookup_plugins = [ QB::ROOT.join('plugins', 'lookup_plugins'), ] end |
Instance Attribute Details
#filter_plugins ⇒ Object (readonly)
Returns the value of attribute filter_plugins.
48 49 50 |
# File 'lib/qb/ansible/env.rb', line 48 def filter_plugins @filter_plugins end |
#library ⇒ Object (readonly)
Returns the value of attribute library.
43 44 45 |
# File 'lib/qb/ansible/env.rb', line 43 def library @library end |
#lookup_plugins ⇒ Object (readonly)
Returns the value of attribute lookup_plugins.
53 54 55 |
# File 'lib/qb/ansible/env.rb', line 53 def lookup_plugins @lookup_plugins end |
#roles_path ⇒ Object (readonly)
Returns the value of attribute roles_path.
38 39 40 |
# File 'lib/qb/ansible/env.rb', line 38 def roles_path @roles_path end |
Class Method Details
.to_var_name(name) ⇒ return_type
TODO:
Document to_var_name method.
Returns @todo Document return value.
26 27 28 |
# File 'lib/qb/ansible/env.rb', line 26 def self.to_var_name name "#{ VAR_NAME_PREFIX }_#{ name.to_s.upcase }" end |
Instance Method Details
#to_h ⇒ return_type
TODO:
Document to_h method.
Returns @todo Document return value.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/qb/ansible/env.rb', line 93 def to_h [ :roles_path, :library, :filter_plugins, :lookup_plugins ].map { |name| value = self.send(name) value = value.join(':') if value.is_a?(Array) [self.class.to_var_name(name), value] }.to_h end |