Class: JSON::Schema::MinLengthAttribute

Inherits:
LimitAttribute show all
Defined in:
lib/json-schema/attributes/limit.rb

Direct Known Subclasses

MaxLengthAttribute

Constant Summary

Constants inherited from Attribute

Attribute::TYPE_CLASS_MAPPINGS

Class Method Summary collapse

Methods inherited from LimitAttribute

exclusive?, invalid?, limit, validate

Methods inherited from Attribute

build_fragment, data_valid_for_type?, validate, validation_error, validation_errors

Class Method Details

.acceptable_typeObject



53
54
55
# File 'lib/json-schema/attributes/limit.rb', line 53

def self.acceptable_type
  String
end

.error_message(schema) ⇒ Object



61
62
63
# File 'lib/json-schema/attributes/limit.rb', line 61

def self.error_message(schema)
  "was not of a minimum string length of #{limit(schema)}"
end

.limit_nameObject



57
58
59
# File 'lib/json-schema/attributes/limit.rb', line 57

def self.limit_name
  'minLength'
end

.value(data) ⇒ Object



65
66
67
# File 'lib/json-schema/attributes/limit.rb', line 65

def self.value(data)
  data.length
end