module Caracal::Core::CustomProperties

This module encapsulates all the functionality related to setting the document's custom properties.

Public Class Methods

included(base) click to toggle source
# 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(options={}, &block)
      model = Caracal::Core::Models::CustomPropertyModel.new(options, &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

Public Instance Methods

custom_property(options={}, &block) click to toggle source

This method controls the custom properties.

# File lib/caracal/core/custom_properties.rb, line 21
def custom_property(options={}, &block)
  model = Caracal::Core::Models::CustomPropertyModel.new(options, &block)
  if model.valid?
    register_property(model)
  end
  model
end
custom_props() click to toggle source
GETTERS =============================
# File lib/caracal/core/custom_properties.rb, line 32
def custom_props
  @custom_props ||= []
end
register_property(model) click to toggle source
REGISTRATION ========================
# File lib/caracal/core/custom_properties.rb, line 39
def register_property(model)
  custom_props << model
  model
end