Module: ActiveEntity::Core::ClassMethods
- Defined in:
- lib/active_entity/core.rb
Instance Attribute Summary collapse
-
#filter_attributes ⇒ Object
Returns columns which shouldn’t be exposed while calling
#inspect.
Instance Method Summary collapse
-
#===(object) ⇒ Object
Overwrite the default class equality method to provide support for decorated models.
-
#generated_association_methods ⇒ Object
:nodoc:.
-
#initialize_generated_modules ⇒ Object
:nodoc:.
-
#inspect ⇒ Object
Returns a string like ‘Post(id:integer, title:string, body:text)’.
Instance Attribute Details
#filter_attributes ⇒ Object
Returns columns which shouldn’t be exposed while calling #inspect.
46 47 48 49 50 51 52 |
# File 'lib/active_entity/core.rb', line 46 def filter_attributes if defined?(@filter_attributes) @filter_attributes else superclass.filter_attributes end end |
Instance Method Details
#===(object) ⇒ Object
Overwrite the default class equality method to provide support for decorated models.
68 69 70 |
# File 'lib/active_entity/core.rb', line 68 def ===(object) # :nodoc: object.is_a?(self) end |
#generated_association_methods ⇒ Object
:nodoc:
35 36 37 38 39 40 41 42 43 |
# File 'lib/active_entity/core.rb', line 35 def generated_association_methods # :nodoc: @generated_association_methods ||= begin mod = const_set(:GeneratedAssociationMethods, Module.new) private_constant :GeneratedAssociationMethods include mod mod end end |
#initialize_generated_modules ⇒ Object
:nodoc:
31 32 33 |
# File 'lib/active_entity/core.rb', line 31 def initialize_generated_modules # :nodoc: generated_association_methods end |
#inspect ⇒ Object
Returns a string like ‘Post(id:integer, title:string, body:text)’
58 59 60 61 62 63 64 65 |
# File 'lib/active_entity/core.rb', line 58 def inspect # :nodoc: if self == Base super else attr_list = attribute_types.map { |name, type| "#{name}: #{type.type}" } * ", " "#{super}#{ "(abstract)" if abstract_class? }(#{attr_list})" end end |