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
Defined Under Namespace
Classes: IgnorePattern
Instance Attribute Summary collapse
-
#ignore_patterns ⇒ Object
readonly
Returns the value of attribute ignore_patterns.
-
#providers ⇒ Object
readonly
Returns the value of attribute providers.
-
#supports_alias ⇒ Object
readonly
Returns the value of attribute supports_alias.
Instance Method Summary collapse
-
#initialize(ignore_patterns: [], providers: nil, supports_alias: nil) ⇒ Config
constructor
A new instance of Config.
- #supports_alias? ⇒ Boolean
- #to_hash ⇒ Object
Constructor Details
#initialize(ignore_patterns: [], providers: nil, supports_alias: nil) ⇒ Config
Returns a new instance of Config.
10 11 12 13 14 15 16 17 |
# File 'lib/record_store/zone/config.rb', line 10 def initialize(ignore_patterns: [], providers: nil, supports_alias: nil) @ignore_patterns = ignore_patterns.map do |ignore_pattern| Zone::Config::IgnorePattern.new(ignore_pattern) 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 |
#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
#supports_alias? ⇒ Boolean
19 20 21 22 23 24 25 |
# File 'lib/record_store/zone/config.rb', line 19 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
27 28 29 30 31 32 33 34 35 |
# File 'lib/record_store/zone/config.rb', line 27 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 |