Skip to content

Commit

Permalink
avoid class variable during pipeline compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
jsvd committed May 17, 2016
1 parent f2d8be1 commit d163917
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions logstash-core/lib/logstash/config/config_ast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ class Whitespace < Node; end
class PluginSection < Node
# Global plugin numbering for the janky instance variable naming we use
# like @filter_<name>_1
@@i = 0
def initialize(*args)
super(*args)
@i = 0
end

# Generate ruby code to initialize all the plugins.
def compile_initializer
Expand Down Expand Up @@ -192,9 +195,9 @@ def generate_variables

plugins.each do |plugin|
# Unique number for every plugin.
@@i += 1
@i += 1
# store things as ivars, like @filter_grok_3
var = "@#{plugin.plugin_type}_#{plugin.plugin_name}_#{@@i}"
var = "@#{plugin.plugin_type}_#{plugin.plugin_name}_#{@i}"
@variables[plugin] = var
end
return @variables
Expand Down

0 comments on commit d163917

Please sign in to comment.