Module: Tutor::Attributes::ClassMethods

Defined in:
lib/tutor/attributes.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



8
9
10
11
# File 'lib/tutor/attributes.rb', line 8

def attributes
  base_attributes = self.superclass.respond_to?(:attributes) ? self.superclass.attributes : []
  (__attributes + base_attributes).uniq(&:name)
end

#has_attribute?(name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/tutor/attributes.rb', line 13

def has_attribute?(name)
  attributes.any? { |attribute| attribute.name == name }
end