Class: LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Plugin
- Inherits:
-
Node
- Object
- Treetop::Runtime::SyntaxNode
- Node
- LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Plugin
show all
- Defined in:
- lib/logstash/compiler/lscl.rb
Constant Summary
Constants included
from Helpers
Helpers::AND_METHOD, Helpers::BOOLEAN_DSL_METHOD_SIGNATURE, Helpers::NAND_METHOD, Helpers::OR_METHOD, 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
75
76
77
|
# File 'lib/logstash/compiler/lscl.rb', line 75
def expr
jdsl.iPlugin(source_meta, plugin_type_enum, self.plugin_name, self.expr_attributes)
end
|
#expr_attributes ⇒ Object
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/logstash/compiler/lscl.rb', line 96
def expr_attributes
self.attributes.recursive_select(Attribute).map(&:expr).map {|k,v|
if v.java_kind_of?(Java::OrgLogstashConfigIrExpression::ValueExpression)
[k, v.get]
else
[k,v]
end
}.reduce({}) do |hash, kv|
k, v = kv
existing = hash[k]
if existing.nil?
hash[k] = v
elsif existing.kind_of?(::Hash)
hash[k] = ::LogStash::Util.hash_merge_many(existing, v)
elsif existing.kind_of?(::Array)
hash[k] = existing.push(*v)
else
hash[k] = [existing, v] unless v == existing
end
hash
end
end
|
#plugin_name ⇒ Object
92
93
94
|
# File 'lib/logstash/compiler/lscl.rb', line 92
def plugin_name
return name.text_value
end
|
#plugin_type_enum ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/logstash/compiler/lscl.rb', line 79
def plugin_type_enum
case section_type
when "input"
Java::OrgLogstashConfigIr::PluginDefinition::Type::INPUT
when "codec"
Java::OrgLogstashConfigIr::PluginDefinition::Type::CODEC
when "filter"
Java::OrgLogstashConfigIr::PluginDefinition::Type::FILTER
when "output"
Java::OrgLogstashConfigIr::PluginDefinition::Type::OUTPUT
end
end
|