Module: Annotations::Acts::AnnotationValue::InstanceMethods

Defined in:
lib/annotations/acts_as_annotation_value.rb

Overview

This module contains instance methods

Instance Method Summary collapse

Instance Method Details

#ann_contentObject

The actual content of the annotation value



102
103
104
# File 'lib/annotations/acts_as_annotation_value.rb', line 102

def ann_content
  self.send(self.class.ann_value_content_field)
end

#ann_content=(val) ⇒ Object

Set the actual content of the annotation value



107
108
109
# File 'lib/annotations/acts_as_annotation_value.rb', line 107

def ann_content=(val)
  self.send("#{self.class.ann_value_content_field}=", val)
end

#annotation_count(attributes) ⇒ Object

The total number of annotations that match one or more attribute names.



96
97
98
99
# File 'lib/annotations/acts_as_annotation_value.rb', line 96

def annotation_count attributes
  attributes = Array(attributes)
  annotations.with_attribute_names(attributes).count
end

#has_attribute_name?(attr) ⇒ Boolean

Whether this value exists with a given attribute name

Returns:

  • (Boolean)


91
92
93
# File 'lib/annotations/acts_as_annotation_value.rb', line 91

def has_attribute_name? attr
  !annotations.with_attribute_name(attr).empty? || !annotation_value_seeds.with_attribute_name(attr).empty?
end