Sha256: c8fbdf56e032dd62bb62fbd54f935b92b3906a068c0932aec8e673cf83dd15a8
Contents?: true
Size: 826 Bytes
Versions: 6
Compression:
Stored size: 826 Bytes
Contents
require 'singleton' module Unimatrix def self.configuration( &block ) Configuration.instance().instance_eval( &block ) unless block.nil? Configuration.instance() end class Configuration include Singleton def self.field( field_name, options={} ) class_eval( "def #{ field_name }( *arguments ); " + "@#{ field_name } = arguments.first unless arguments.empty?; " + "@#{ field_name } || " + ( options[ :default ].nil? ? "nil" : ( options[ :default ].is_a?( String ) ? "'#{ options[ :default ] }'" : "#{ options[ :default ] }" ) ) + ";" + "end", __FILE__, __LINE__ ) end field :url, default: ENV[ 'UNIMATRIX_API_URL' ] end end
Version data entries
6 entries across 6 versions & 1 rubygems