Sha256: e8b30540bee07d8bb113b0bcd8afbd2cac1f71fc96ccd3b1323a9bb10bbed7fc
Contents?: true
Size: 495 Bytes
Versions: 11
Compression:
Stored size: 495 Bytes
Contents
require 'singleton' module Wikipedia class Configuration include Singleton def self.directives(*directives) directives.each do |directive| define_method directive do |*args| return instance_variable_get("@#{directive}") if args.empty? instance_variable_set("@#{directive}", args.first) end end end def self.[](directive) instance.send(directive) end directives :protocol, :domain, :path, :user_agent end end
Version data entries
11 entries across 11 versions & 1 rubygems