Class: RecordStore::Zone::Config
- Inherits:
-
Object
- Object
- RecordStore::Zone::Config
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/record_store/zone/config.rb,
lib/record_store/zone/config/ignore_pattern.rb,
lib/record_store/zone/config/implicit_record_template.rb
Defined Under Namespace
Classes: IgnorePattern, ImplicitRecordTemplate, TemplateContext
Instance Attribute Summary collapse
-
#ignore_patterns ⇒ Object
readonly
Returns the value of attribute ignore_patterns.
-
#implicit_records_templates ⇒ Object
readonly
Returns the value of attribute implicit_records_templates.
-
#providers ⇒ Object
readonly
Returns the value of attribute providers.
-
#supports_alias ⇒ Object
readonly
Returns the value of attribute supports_alias.
Instance Method Summary collapse
- #empty_non_terminal_over_wildcard? ⇒ Boolean
-
#initialize(ignore_patterns: [], providers: nil, supports_alias: nil, implicit_records_templates: []) ⇒ Config
constructor
A new instance of Config.
- #supports_alias? ⇒ Boolean
- #to_hash ⇒ Object
Constructor Details
#initialize(ignore_patterns: [], providers: nil, supports_alias: nil, implicit_records_templates: []) ⇒ Config
Returns a new instance of Config.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/record_store/zone/config.rb', line 10 def initialize(ignore_patterns: [], providers: nil, supports_alias: nil, implicit_records_templates: []) @ignore_patterns = ignore_patterns.map do |ignore_pattern| Zone::Config::IgnorePattern.new(ignore_pattern) end @implicit_records_templates = implicit_records_templates.map do |filename| Zone::Config::ImplicitRecordTemplate.from_file(filename: filename) end @providers = providers @supports_alias = supports_alias end |
Instance Attribute Details
#ignore_patterns ⇒ Object (readonly)
Returns the value of attribute ignore_patterns.
6 7 8 |
# File 'lib/record_store/zone/config.rb', line 6 def ignore_patterns @ignore_patterns end |
#implicit_records_templates ⇒ Object (readonly)
Returns the value of attribute implicit_records_templates.
6 7 8 |
# File 'lib/record_store/zone/config.rb', line 6 def implicit_records_templates @implicit_records_templates end |
#providers ⇒ Object (readonly)
Returns the value of attribute providers.
6 7 8 |
# File 'lib/record_store/zone/config.rb', line 6 def providers @providers end |
#supports_alias ⇒ Object (readonly)
Returns the value of attribute supports_alias.
6 7 8 |
# File 'lib/record_store/zone/config.rb', line 6 def supports_alias @supports_alias end |
Instance Method Details
#empty_non_terminal_over_wildcard? ⇒ Boolean
29 30 31 |
# File 'lib/record_store/zone/config.rb', line 29 def empty_non_terminal_over_wildcard? valid_providers? && providers.any? { |provider| Provider.const_get(provider).empty_non_terminal_over_wildcard? } end |
#supports_alias? ⇒ Boolean
21 22 23 24 25 26 27 |
# File 'lib/record_store/zone/config.rb', line 21 def supports_alias? if @supports_alias.nil? valid_providers? && providers.all? { |provider| Provider.const_get(provider).supports_alias? } else @supports_alias end end |
#to_hash ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/record_store/zone/config.rb', line 33 def to_hash config_hash = { providers: providers, ignore_patterns: ignore_patterns.map(&:to_hash), } config_hash.merge!(supports_alias: supports_alias) if supports_alias config_hash end |