class Puppet::Parser::Scope::MatchScope

Attributes

match_data[RW]

Public Instance Methods

[](name) click to toggle source
# File lib/puppet/parser/scope.rb, line 140
def [](name)
  if bound?(name)
    @match_data[name.to_i]
  else
    super
  end
end
[]=(name, value) click to toggle source
# File lib/puppet/parser/scope.rb, line 159
def []=(name, value)
  # TODO: Bad choice of exception
  raise Puppet::ParseError, "Numerical variables cannot be changed. Attempt to set $#{name}"
end
add_entries_to(target = {}) click to toggle source
# File lib/puppet/parser/scope.rb, line 169
def add_entries_to(target = {})
  # do not include match data ($0-$n)
  super
end
bound?(name) click to toggle source
# File lib/puppet/parser/scope.rb, line 152
def bound?(name)
  # A "match variables" scope reports all numeric variables to be bound if the scope has
  # match_data. Without match data the scope is transparent.
  #
  @match_data && name =~ /^\d+$/
end
delete(name) click to toggle source
# File lib/puppet/parser/scope.rb, line 164
def delete(name)
  # TODO: Bad choice of exception
  raise Puppet::ParseError, "Numerical variables cannot be deleted: Attempt to delete: $#{name}"
end
include?(name) click to toggle source
# File lib/puppet/parser/scope.rb, line 148
def include?(name)
  bound?(name) or super
end
is_local_scope?() click to toggle source
# File lib/puppet/parser/scope.rb, line 136
def is_local_scope?
  false
end

Public Class Methods

new(parent = nil, match_data = nil) click to toggle source
# File lib/puppet/parser/scope.rb, line 131
def initialize(parent = nil, match_data = nil)
  super parent
  @match_data = match_data
end