lib/dsu/models/entry.rb in dsu-0.1.0.alpha.1 vs lib/dsu/models/entry.rb in dsu-0.1.0.alpha.2

- old
+ new

@@ -9,41 +9,32 @@ validates :uuid, presence: true, format: { with: /\A[0-9a-f]{8}\z/i, message: 'is the wrong format. ' \ '0-9, a-f, and 8 characters were expected.' \ } - validates :description, presence: true, length: { minimum: 2, maximum: 80 } - validates :long_description, length: { minimum: 2, maximum: 256 }, allow_nil: true + validates :description, presence: true, length: { minimum: 2, maximum: 256 } - def initialize(description:, uuid: nil, long_description: nil) + def initialize(description:, uuid: nil) raise ArgumentError, 'description is nil' if description.nil? raise ArgumentError, 'description is the wrong object type' unless description.is_a?(String) raise ArgumentError, 'uuid is the wrong object type' unless uuid.is_a?(String) || uuid.nil? - raise ArgumentError, 'long_description is the wrong object type' unless long_description.is_a?(String) || long_description.nil? uuid ||= SecureRandom.uuid[0..7] super(hash: { uuid: uuid, - description: description, - long_description: long_description + description: description }) end def required_fields %i[uuid description] end - def long_description? - long_description.present? - end - def ==(other) return false unless other.is_a?(Entry) - uuid == other.uuid && - description == other.description && - long_description == other.long_description + uuid == other.uuid && description == other.description end end end end