Class: Hiera::Scope
- Inherits:
-
Object
- Object
- Hiera::Scope
- Defined in:
- lib/hiera/scope.rb
Instance Attribute Summary collapse
-
#real ⇒ Object
readonly
Returns the value of attribute real.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #catalog ⇒ Object
- #compiler ⇒ Object
- #include?(key) ⇒ Boolean
-
#initialize(real) ⇒ Scope
constructor
A new instance of Scope.
- #resource ⇒ Object
Constructor Details
#initialize(real) ⇒ Scope
Returns a new instance of Scope.
5 6 7 |
# File 'lib/hiera/scope.rb', line 5 def initialize(real) @real = real end |
Instance Attribute Details
#real ⇒ Object (readonly)
Returns the value of attribute real.
3 4 5 |
# File 'lib/hiera/scope.rb', line 3 def real @real end |
Instance Method Details
#[](key) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hiera/scope.rb', line 9 def [](key) if key == "calling_class" ans = @real.resource.name.to_s.downcase elsif key == "calling_module" ans = @real.resource.name.to_s.downcase.split("::").first else ans = @real.lookupvar(key) end # damn you puppet visual basic style variables. return nil if ans == "" return ans end |
#catalog ⇒ Object
29 30 31 |
# File 'lib/hiera/scope.rb', line 29 def catalog @real.catalog end |
#compiler ⇒ Object
37 38 39 |
# File 'lib/hiera/scope.rb', line 37 def compiler @real.compiler end |
#include?(key) ⇒ Boolean
23 24 25 26 27 |
# File 'lib/hiera/scope.rb', line 23 def include?(key) return true if ["calling_class", "calling_module"].include?(key) return @real.lookupvar(key) != "" end |
#resource ⇒ Object
33 34 35 |
# File 'lib/hiera/scope.rb', line 33 def resource @real.resource end |