Class: Kombo::Models::Shared::PropertiesText

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Crystalline::MetadataFields
Defined in:
lib/kombo/models/shared/properties_text.rb

Instance Method Summary collapse

Methods included from Crystalline::MetadataFields

#field, #fields, included, #marshal_single, #to_dict, #to_json

Constructor Details

#initialize(label:, required:, type:, description: nil, unified_key: nil, min_length: nil, max_length: nil, reg_exp: nil) ⇒ PropertiesText

Returns a new instance of PropertiesText.



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/kombo/models/shared/properties_text.rb', line 33

def initialize(label:, required:, type:, description: nil, unified_key: nil, min_length: nil, max_length: nil, reg_exp: nil)
  @label = label
  @required = required
  unless type == 'text'
    raise ArgumentError, 'Invalid value for type'
  end
  @type = 'text'
  @description = description
  @unified_key = unified_key
  @min_length = min_length
  @max_length = max_length
  @reg_exp = reg_exp
end

Instance Method Details

#==(other) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/kombo/models/shared/properties_text.rb', line 48

def ==(other)
  return false unless other.is_a? self.class
  return false unless @label == other.label
  return false unless @required == other.required
  return false unless @type == other.type
  return false unless @description == other.description
  return false unless @unified_key == other.unified_key
  return false unless @min_length == other.min_length
  return false unless @max_length == other.max_length
  return false unless @reg_exp == other.reg_exp
  true
end