Sha256: 7c065c3eaaa8d21f7e039a89912e8af4c212e928ba43ea4771ae4fcdc0adfc14
Contents?: true
Size: 1.36 KB
Versions: 24
Compression:
Stored size: 1.36 KB
Contents
require 'caracal/core/models/base_model' module Caracal module Core module Models # This class encapsulates the logic needed to store and manipulate # custom properties # class CustomPropertyModel < BaseModel # accessors attr_reader :custom_property_name attr_reader :custom_property_value attr_reader :custom_property_type #------------------------------------------------------------- # Public Instance Methods #------------------------------------------------------------- #=================== SETTERS ============================= def name(value) @custom_property_name = value.to_s end def value(value) @custom_property_value = value.to_s end def type(value) @custom_property_type = value.to_s end #=============== VALIDATION =========================== def valid? required = option_keys required.all? { |m| !send("custom_property_#{ m }").nil? } end #------------------------------------------------------------- # Private Instance Methods #------------------------------------------------------------- private def option_keys [:name, :value, :type] end end end end end
Version data entries
24 entries across 24 versions & 2 rubygems