lib/knowledge_base/configuration.rb in knowledge_base-0.0.3 vs lib/knowledge_base/configuration.rb in knowledge_base-0.1.0

- old
+ new

@@ -1,5 +1,23 @@ module KnowledgeBase class Configuration - attr_accessor :storage + configs = { + storage: :file, + categories_path: 'categories', + articles_path: 'articles' + } + + configs.each do |config, default| + attr_writer config + + define_method config do + value = instance_variable_get "@#{config}" + + if value.nil? + default + else + value + end + end + end end end