class Puppet::Parser::Scope::MatchScope

Attributes

match_data[RW]

Public Class Methods

new(parent = nil, match_data = nil) click to toggle source
Calls superclass method Puppet::Parser::Scope::Ephemeral::new
    # File lib/puppet/parser/scope.rb
126 def initialize(parent = nil, match_data = nil)
127   super parent
128   @match_data = match_data
129 end

Public Instance Methods

[](name) click to toggle source
Calls superclass method Puppet::Parser::Scope::Ephemeral#[]
    # File lib/puppet/parser/scope.rb
135 def [](name)
136   if bound?(name)
137     @match_data[name.to_i]
138   else
139     super
140   end
141 end
[]=(name, value) click to toggle source
    # File lib/puppet/parser/scope.rb
154 def []=(name, value)
155   # TODO: Bad choice of exception
156   raise Puppet::ParseError, _("Numerical variables cannot be changed. Attempt to set $%{name}") % { name: name }
157 end
add_entries_to(target = {}, include_undef = false) click to toggle source
    # File lib/puppet/parser/scope.rb
164 def add_entries_to(target = {}, include_undef = false)
165   # do not include match data ($0-$n)
166   super
167 end
bound?(name) click to toggle source
    # File lib/puppet/parser/scope.rb
147 def bound?(name)
148   # A "match variables" scope reports all numeric variables to be bound if the scope has
149   # match_data. Without match data the scope is transparent.
150   #
151   @match_data && name =~ /^\d+$/
152 end
delete(name) click to toggle source
    # File lib/puppet/parser/scope.rb
159 def delete(name)
160   # TODO: Bad choice of exception
161   raise Puppet::ParseError, _("Numerical variables cannot be deleted: Attempt to delete: $%{name}") % { name: name }
162 end
include?(name) click to toggle source
    # File lib/puppet/parser/scope.rb
143 def include?(name)
144   bound?(name) or super
145 end
is_local_scope?() click to toggle source
    # File lib/puppet/parser/scope.rb
131 def is_local_scope?
132   false
133 end