Module: Caracal::Core::CustomProperties
- Included in:
- Document
- Defined in:
- lib/caracal/core/custom_properties.rb
Overview
This module encapsulates all the functionality related to setting the document’s custom properties.
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/caracal/core/custom_properties.rb', line 12 def self.included(base) base.class_eval do #------------------------------------------------------------- # Public Methods #------------------------------------------------------------- # This method controls the custom properties. # def custom_property(={}, &block) model = Caracal::Core::Models::CustomPropertyModel.new(, &block) if model.valid? register_property(model) end model end #============== GETTERS ============================= def custom_props @custom_props ||= [] end #============== REGISTRATION ======================== def register_property(model) custom_props << model model end end end |