Method: ObjectStruct.property_type
- Defined in:
- lib/object_struct/object_struct.rb
.property_type(options) ⇒ Object
Specify the type of a particular property.
48 49 50 51 52 53 54 |
# File 'lib/object_struct/object_struct.rb', line 48 def self.property_type() plural = .delete(:plural) property, type = *.first class_name = plural ? property.to_s.classify : property.to_s.camelize klass = (name.split('::')[0..-2]).join('::').constantize rescue Object klass.const_set class_name, Class.new(type) end |