Class: RecordStore::Zone::Config
- Inherits:
-
Object
- Object
- RecordStore::Zone::Config
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/record_store/zone/config.rb
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
10 11 12 13 14 |
# File 'lib/record_store/zone/config.rb', line 10 def initialize(ignore_patterns: [], providers: nil, supports_alias: nil) @ignore_patterns = ignore_patterns @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
16 17 18 19 20 21 22 |
# File 'lib/record_store/zone/config.rb', line 16 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
24 25 26 27 28 29 30 31 32 |
# File 'lib/record_store/zone/config.rb', line 24 def to_hash config_hash = { providers: providers, ignore_patterns: ignore_patterns, } config_hash.merge!(supports_alias: supports_alias) if supports_alias config_hash end |