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
125 def initialize(parent = nil, match_data = nil)
126   super parent
127   @match_data = match_data
128 end

Public Instance Methods

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