Class: RemoveDataAttributes::Configuration
- Inherits:
-
Object
- Object
- RemoveDataAttributes::Configuration
- Defined in:
- lib/remove_data_attributes/configuration.rb
Constant Summary collapse
- SUPPORTED_FILE_FORMATS =
{ "YAML" => [".yml", ".yaml"].freeze }.freeze
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Configuration
constructor
:reek:ManualDispatch.
Constructor Details
#initialize(attributes = {}) ⇒ Configuration
:reek:ManualDispatch
41 42 43 44 45 46 |
# File 'lib/remove_data_attributes/configuration.rb', line 41 def initialize(attributes = {}) attributes.each do |attribute_name, value| method_name = "#{attribute_name}=" public_send(method_name, value) if respond_to?(method_name) end end |
Instance Attribute Details
#data_attributes ⇒ Object
48 49 50 |
# File 'lib/remove_data_attributes/configuration.rb', line 48 def data_attributes @data_attributes ||= [] end |
Class Method Details
.from_file(filename) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/remove_data_attributes/configuration.rb', line 15 def from_file(filename) loader = loader_for(::File.extname(filename)) unless loader = "This file format is not supported." raise ::RemoveDataAttributes::InvalidConfiguration, end ::File.open(filename) { |file| new(loader.load(file)) } end |
.supported_file_extensions ⇒ Object
26 27 28 |
# File 'lib/remove_data_attributes/configuration.rb', line 26 def supported_file_extensions @supported_file_extensions ||= SUPPORTED_FILE_FORMATS.values.flatten.sort end |