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 Content instances. It provides convenient methods for finding content based 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
101 102 103 |
# File 'lib/datadog/core/remote/configuration/content.rb', line 101 def [](path) find { |c| c.path.eql?(path) } end |
#[]=(path, content) ⇒ Object
105 106 107 |
# File 'lib/datadog/core/remote/configuration/content.rb', line 105 def []=(path, content) map! { |c| c.path.eql?(path) ? content : c } end |
#delete(path) ⇒ Object
109 110 111 112 113 114 115 |
# File 'lib/datadog/core/remote/configuration/content.rb', line 109 def delete(path) idx = index { |e| e.path.eql?(path) } return if idx.nil? delete_at(idx) end |
#find_content(path, target) ⇒ Object
97 98 99 |
# File 'lib/datadog/core/remote/configuration/content.rb', line 97 def find_content(path, target) find { |c| c.path.eql?(path) && target.check(c) } end |
#paths ⇒ Object
117 118 119 |
# File 'lib/datadog/core/remote/configuration/content.rb', line 117 def paths map(&:path).uniq end |