Class: Datadog::Core::Remote::Configuration::ContentList
- Inherits:
-
Array
- Object
- Array
- Datadog::Core::Remote::Configuration::ContentList
- Defined in:
- lib/datadog/core/remote/configuration/content.rb
Overview
ContentList stores a list of Conetnt instances It provides convinient methods for finding content base on Configuration::Path and Configuration::Target
Class Method Summary collapse
Instance Method Summary collapse
- #[](path) ⇒ Object
- #[]=(path, content) ⇒ Object
- #delete(path) ⇒ Object
- #find_content(path, target) ⇒ Object
- #paths ⇒ Object
Class Method Details
Instance Method Details
#[](path) ⇒ Object
88 89 90 |
# File 'lib/datadog/core/remote/configuration/content.rb', line 88 def [](path) find { |c| c.path.eql?(path) } end |
#[]=(path, content) ⇒ Object
92 93 94 |
# File 'lib/datadog/core/remote/configuration/content.rb', line 92 def []=(path, content) map! { |c| c.path.eql?(path) ? content : c } end |
#delete(path) ⇒ Object
96 97 98 99 100 101 102 |
# File 'lib/datadog/core/remote/configuration/content.rb', line 96 def delete(path) idx = index { |e| e.path.eql?(path) } return if idx.nil? delete_at(idx) end |
#find_content(path, target) ⇒ Object
84 85 86 |
# File 'lib/datadog/core/remote/configuration/content.rb', line 84 def find_content(path, target) find { |c| c.path.eql?(path) && target.check(c) } end |
#paths ⇒ Object
104 105 106 |
# File 'lib/datadog/core/remote/configuration/content.rb', line 104 def paths map(&:path).uniq end |