Class: ActiveRecord::Events::MethodFactory
- Inherits:
-
Object
- Object
- ActiveRecord::Events::MethodFactory
- Defined in:
- lib/active_record/events/method_factory.rb
Instance Attribute Summary collapse
-
#naming ⇒ Object
readonly
Returns the value of attribute naming.
Instance Method Summary collapse
- #class_methods ⇒ Object
-
#initialize(event_name, options) ⇒ MethodFactory
constructor
A new instance of MethodFactory.
- #instance_methods ⇒ Object
Constructor Details
#initialize(event_name, options) ⇒ MethodFactory
Returns a new instance of MethodFactory.
8 9 10 11 |
# File 'lib/active_record/events/method_factory.rb', line 8 def initialize(event_name, ) = @naming = Naming.new(event_name, ) end |
Instance Attribute Details
#naming ⇒ Object (readonly)
Returns the value of attribute naming.
6 7 8 |
# File 'lib/active_record/events/method_factory.rb', line 6 def naming @naming end |
Instance Method Details
#class_methods ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/active_record/events/method_factory.rb', line 28 def class_methods Module.new.tap do |module_| define_collective_action_method(module_, naming) unless [:skip_scopes] define_scope_method(module_, naming) define_inverse_scope_method(module_, naming) end end end |
#instance_methods ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/active_record/events/method_factory.rb', line 13 def instance_methods Module.new.tap do |module_| field_type = naming.field_database_type define_predicate_method(module_, naming) define_inverse_predicate_method(module_, naming) define_action_method(module_, naming) define_inverse_action_method(module_, naming) define_safe_action_method(module_, naming) define_inverse_safe_action_method(module_, naming) define_boolean_attribute_method(module_, naming) end end |