Class: Unimatrix::Configuration
- Inherits:
-
Object
- Object
- Unimatrix::Configuration
- Includes:
- Singleton
- Defined in:
- lib/unimatrix/configuration.rb
Class Method Summary collapse
Class Method Details
.field(field_name, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/unimatrix/configuration.rb', line 13 def self.field( field_name, ={} ) class_eval( "def #{ field_name }( *arguments ); " + "@#{ field_name } = arguments.first unless arguments.empty?; " + "@#{ field_name } || " + ( [ :default ].nil? ? "nil" : ( [ :default ].is_a?( String ) ? "'#{ [ :default ] }'" : "#{ [ :default ] }" ) ) + ";" + "end", __FILE__, __LINE__ ) end |