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.



33
34
35
36
# File 'lib/vestal_versions/version_tagging.rb', line 33

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)


39
40
41
# File 'lib/vestal_versions/version_tagging.rb', line 39

def tagged?
  !tag.nil?
end

#validate_tags?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/vestal_versions/version_tagging.rb', line 43

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