Module: VestalVersions::VersionTagging::VersionMethods

Extended by:
ActiveSupport::Concern
Defined in:
lib/vestal_versions/version_tagging.rb

Overview

Instance methods included into VestalVersions::Version to enable version tagging.

Instance Method Summary collapse

Instance Method Details

#tag!(tag) ⇒ Object

Attaches the given string to the version tag column. If the uniqueness validation fails, nil is returned. Otherwise, the given string is returned.



31
32
33
34
# File 'lib/vestal_versions/version_tagging.rb', line 31

def tag!(tag)
  write_attribute(:tag, tag)
  save ? tag : nil
end

#tagged?Boolean

Simply returns a boolean signifying whether the version instance has a tag value attached.

Returns:

  • (Boolean)


37
38
39
# File 'lib/vestal_versions/version_tagging.rb', line 37

def tagged?
  !tag.nil?
end

#validate_tags?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/vestal_versions/version_tagging.rb', line 41

def validate_tags?
  tagged? && tag != 'deleted'
end