Sha256: 8539a4c67ebf1cab14459af561149d6ef85fa0afdea9cdeb69f41939f6bda63c
Contents?: true
Size: 990 Bytes
Versions: 2
Compression:
Stored size: 990 Bytes
Contents
module Doorkeeper def self.configure(&block) @@config = Config.new(&block) end class Config module ConfigOptions def register_config_option(name, attribute, receives_block = true) define_method name do |*args, &block| if receives_block self.instance_variable_set(:"@#{attribute}", block) else self.instance_variable_set(:"@#{attribute}", args[0]) end end attr_reader attribute public attribute Doorkeeper.class_eval " def self.#{attribute} @@config.#{attribute} end " end def extended(base) base.send(:private, :register_method) end end extend ConfigOptions register_config_option :resource_owner_authenticator, :authenticate_resource_owner register_config_option :admin_authenticator, :authenticate_admin def initialize(&block) instance_eval &block end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
doorkeeper-0.1.1 | lib/doorkeeper/config.rb |
doorkeeper-0.1.0 | lib/doorkeeper/config.rb |