Class: Fluent::Config::Section
- Inherits:
-
BasicObject
- Defined in:
- lib/fluent/config/section.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(params = {}) ⇒ Section
Returns a new instance of Section.
29
30
31
32
|
# File 'lib/fluent/config/section.rb', line 29
def initialize(params = {})
@klass = 'Fluent::Config::Section'
@params = params
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
69
70
71
72
73
74
75
|
# File 'lib/fluent/config/section.rb', line 69
def method_missing(name, *args)
if @params.has_key?(name)
@params[name]
else
super
end
end
|
Class Method Details
.name ⇒ Object
25
26
27
|
# File 'lib/fluent/config/section.rb', line 25
def self.name
'Fluent::Config::Section'
end
|
Instance Method Details
#+(other) ⇒ Object
48
49
50
|
# File 'lib/fluent/config/section.rb', line 48
def +(other)
Section.new(self.to_h.merge(other.to_h))
end
|
#[](key) ⇒ Object
61
62
63
|
# File 'lib/fluent/config/section.rb', line 61
def [](key)
@params[key.to_sym]
end
|
#inspect ⇒ Object
36
37
38
|
# File 'lib/fluent/config/section.rb', line 36
def inspect
"<Fluent::Config::Section #{@params.to_json}>"
end
|
#instance_of?(mod) ⇒ Boolean
52
53
54
|
# File 'lib/fluent/config/section.rb', line 52
def instance_of?(mod)
@klass == mod.name
end
|
#kind_of?(mod) ⇒ Boolean
Also known as:
is_a?
56
57
58
|
# File 'lib/fluent/config/section.rb', line 56
def kind_of?(mod)
@klass == mod.name || BasicObject == mod
end
|
#nil? ⇒ Boolean
40
41
42
|
# File 'lib/fluent/config/section.rb', line 40
def nil?
false
end
|
#respond_to_missing?(symbol, include_private) ⇒ Boolean
65
66
67
|
# File 'lib/fluent/config/section.rb', line 65
def respond_to_missing?(symbol, include_private)
@params.has_key?(symbol)
end
|
#to_h ⇒ Object
44
45
46
|
# File 'lib/fluent/config/section.rb', line 44
def to_h
@params
end
|