Class: LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Hash
- Inherits:
-
Value
- Object
- Treetop::Runtime::SyntaxNode
- Node
- RValue
- Value
- LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Hash
show all
- Defined in:
- lib/logstash/compiler/lscl.rb
Constant Summary
Constants included
from Helpers
LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers::AND_METHOD, LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers::BOOLEAN_DSL_METHOD_SIGNATURE, LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers::NAND_METHOD, LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers::OR_METHOD, LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers::XOR_METHOD
Instance Method Summary
collapse
Methods inherited from Node
#section_type
Methods included from Helpers
#base_id, #base_protocol, #base_source_with_metadata, #base_source_with_metadata=, #compose, #compose_for, #jdsl, jdsl, #line_and_column, #source_meta
Instance Method Details
#expr ⇒ Object
201
202
203
204
|
# File 'lib/logstash/compiler/lscl.rb', line 201
def expr
validate!
jdsl.eValue(source_meta, ::Hash[recursive_select(HashEntry).map(&:expr)])
end
|
#find_duplicate_keys ⇒ Object
196
197
198
199
|
# File 'lib/logstash/compiler/lscl.rb', line 196
def find_duplicate_keys
values = recursive_select(HashEntry).collect { |hash_entry| hash_entry.name.text_value }
values.find_all { |v| values.count(v) > 1 }.uniq
end
|
#validate! ⇒ Object
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
# File 'lib/logstash/compiler/lscl.rb', line 180
def validate!
duplicate_values = find_duplicate_keys
if duplicate_values.size > 0
raise ::LogStash::ConfigurationError.new(
I18n.t("logstash.runner.configuration.invalid_plugin_settings_duplicate_keys",
:keys => duplicate_values.join(', '),
:line => input.line_of(interval.first),
:column => input.column_of(interval.first),
:byte => interval.first + 1,
:after => input[0..interval.first]
)
)
end
end
|