Module: Confy::Backend

Defined in:
lib/confy/backend.rb,
lib/confy/backend/xml.rb,
lib/confy/backend/base.rb,
lib/confy/backend/json.rb,
lib/confy/backend/yaml.rb,
lib/confy/backend/simple_assignment.rb

Defined Under Namespace

Classes: Base, Json, SimpleAssignment, Xml, Yaml

Class Method Summary collapse

Class Method Details

.register(*args) ⇒ Object

backend should call this method automatically once defined to register themselves as a backend



19
20
21
22
23
24
# File 'lib/confy/backend/base.rb', line 19

def register *args
  options      = args.last.is_a?(Hash) ? args.pop : {}
  extension    = args.first
  options[:as] = "#{extension.to_s[0].upcase}#{extension.to_s[1..-1]}" if options[:as].nil?
  args.flatten.map{|ext| Base.extensions.<<([ext.to_s, options[:as].to_s]) }
end