Class: Caracal::Core::Models::CustomPropertyModel

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/caracal/core/models/custom_property_model.rb

Overview

This class encapsulates the logic needed to store and manipulate custom properties

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#initialize

Constructor Details

This class inherits a constructor from Caracal::Core::Models::BaseModel

Instance Attribute Details

#custom_property_nameObject (readonly)

accessors



14
15
16
# File 'lib/caracal/core/models/custom_property_model.rb', line 14

def custom_property_name
  @custom_property_name
end

#custom_property_typeObject (readonly)

Returns the value of attribute custom_property_type.



16
17
18
# File 'lib/caracal/core/models/custom_property_model.rb', line 16

def custom_property_type
  @custom_property_type
end

#custom_property_valueObject (readonly)

Returns the value of attribute custom_property_value.



15
16
17
# File 'lib/caracal/core/models/custom_property_model.rb', line 15

def custom_property_value
  @custom_property_value
end

Instance Method Details

#name(value) ⇒ Object

SETTERS =============================


26
27
28
# File 'lib/caracal/core/models/custom_property_model.rb', line 26

def name(value)
  @custom_property_name = value.to_s
end

#type(value) ⇒ Object



34
35
36
# File 'lib/caracal/core/models/custom_property_model.rb', line 34

def type(value)
  @custom_property_type = value.to_s
end

#valid?Boolean

VALIDATION ===========================

Returns:

  • (Boolean)


41
42
43
44
# File 'lib/caracal/core/models/custom_property_model.rb', line 41

def valid?
  required = option_keys
  required.all? { |m| !send("custom_property_#{ m }").nil? }
end

#value(value) ⇒ Object



30
31
32
# File 'lib/caracal/core/models/custom_property_model.rb', line 30

def value(value)
  @custom_property_value = value.to_s
end