Class: DruidConfig::Entities::RuleCollection
- Inherits:
-
Array
- Object
- Array
- DruidConfig::Entities::RuleCollection
- Defined in:
- lib/druid_config/entities/rule_collection.rb
Overview
Rule set of a data source
Instance Method Summary collapse
-
#consistent? ⇒ Boolean
Check the consistency of the rules.
-
#to_json(include_datasources = false) ⇒ Object
Return the collection of rules as a valid JSON for Druid.
Instance Method Details
#consistent? ⇒ Boolean
Check the consistency of the rules. For example, if you define the following rules:
1 - LOAD ByPeriod PT12M replicants -> { _default_tier => 1 } 2 - LOAD ByPeriod PT3M replicants -> { _default_tier => 1 }
The second rule never be applied.
This method don’t raise any exception and your Druid installation will work unless there are an inconsistence. The purpose of this method is to advise you could be wrong about rules
Returns:
A boolean. True when the rules are consistent.
23 24 25 26 |
# File 'lib/druid_config/entities/rule_collection.rb', line 23 def consistent? # TODO: implement this method true end |
#to_json(include_datasources = false) ⇒ Object
Return the collection of rules as a valid JSON for Druid
Parameters:
- include_datasources
-
True if you want to include the name of the datasources as keys (False by default)
Returns:
JSON String
39 40 41 42 |
# File 'lib/druid_config/entities/rule_collection.rb', line 39 def to_json(include_datasources = false) return to_json_with_datasources if include_datasources map(&:to_h).to_json end |