Class: OryClient::CreateProjectNormalizedPayload::EnumAttributeValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/ory-client/models/create_project_normalized_payload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(datatype, allowable_values) ⇒ EnumAttributeValidator

Returns a new instance of EnumAttributeValidator.



904
905
906
907
908
909
910
911
912
913
914
915
# File 'lib/ory-client/models/create_project_normalized_payload.rb', line 904

def initialize(datatype, allowable_values)
  @allowable_values = allowable_values.map do |value|
    case datatype.to_s
    when /Integer/i
      value.to_i
    when /Float/i
      value.to_f
    else
      value
    end
  end
end

Instance Attribute Details

#allowable_values ⇒ Object (readonly)

Returns the value of attribute allowable_values.



902
903
904
# File 'lib/ory-client/models/create_project_normalized_payload.rb', line 902

def allowable_values
  @allowable_values
end

#datatype ⇒ Object (readonly)

Returns the value of attribute datatype.



901
902
903
# File 'lib/ory-client/models/create_project_normalized_payload.rb', line 901

def datatype
  @datatype
end

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


917
918
919
# File 'lib/ory-client/models/create_project_normalized_payload.rb', line 917

def valid?(value)
  !value || allowable_values.include?(value)
end