Module: Superstore::AttributeMethods::ClassMethods

Defined in:
lib/superstore/attribute_methods.rb

Instance Method Summary collapse

Instance Method Details

#attribute_methods_generated?Boolean

Returns:

  • (Boolean)

33
34
35
# File 'lib/superstore/attribute_methods.rb', line 33

def attribute_methods_generated?
  @attribute_methods_generated ||= false
end

#dangerous_attribute_method?(name) ⇒ Boolean

Returns:

  • (Boolean)

37
38
39
# File 'lib/superstore/attribute_methods.rb', line 37

def dangerous_attribute_method?(name)
  false
end

#define_attribute_methodsObject


27
28
29
30
31
# File 'lib/superstore/attribute_methods.rb', line 27

def define_attribute_methods
  return if attribute_methods_generated?
  super(attribute_definitions.keys)
  @attribute_methods_generated = true
end

#has_attribute?(attr_name) ⇒ Boolean

Returns:

  • (Boolean)

41
42
43
# File 'lib/superstore/attribute_methods.rb', line 41

def has_attribute?(attr_name)
  attribute_definitions.key?(attr_name.to_s)
end

#inherited(child_class) ⇒ Object


22
23
24
25
# File 'lib/superstore/attribute_methods.rb', line 22

def inherited(child_class)
  child_class.define_attribute_methods
  super
end