Sha256: 6f93cf21e0a9b31a5511b913d247c1d6581ef212c534743b48a3c27a83e9b60b

Contents?: true

Size: 458 Bytes

Versions: 3

Compression:

Stored size: 458 Bytes

Contents

module Aninipot
  module Configuration
    def self.included(base)
      base.extend ClassMethods
    end
  
    module ClassMethods
      def configure(&block)
        config = self.new
        raise ArgumentError, "Please provide configuration block" unless block_given?
        yield config
    
        [:api].each do |required|
          raise "#{required} is required" unless config.send(required)
        end
        config
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aninipot-0.0.3 lib/aninipot/config.rb
aninipot-0.0.2 lib/aninipot/config.rb
aninipot-0.0.1 lib/aninipot/config.rb