Module: Persisted
- Extended by:
- ActiveSupport::Concern
- Includes:
- RecordCreator, RecordFinder
- Defined in:
- lib/persisted.rb,
lib/persisted/version.rb,
lib/persisted/record_finder.rb,
lib/persisted/record_creator.rb
Overview
Adds persistence to a Ruby Object
Defined Under Namespace
Modules: ClassMethods, RecordCreator, RecordFinder
Constant Summary collapse
- VERSION =
'0.0.1'
Instance Method Summary collapse
- #method_missing(method_name, *args) ⇒ Object
- #persisted_record=(record) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Methods included from RecordCreator
#attributes_for_creation, #create_record, #persisted_record
Methods included from RecordFinder
#attributes_for_finding, #existing_record, #persisted_record
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/persisted.rb', line 18 def method_missing( method_name, *args ) if persisted_record.respond_to? method_name persisted_record.send method_name, *args else super end end |
Instance Method Details
#persisted_record=(record) ⇒ Object
14 15 16 |
# File 'lib/persisted.rb', line 14 def persisted_record=( record ) @persisted_record = record end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
26 27 28 |
# File 'lib/persisted.rb', line 26 def respond_to_missing?( method_name, include_private = false ) super || persisted_record.respond_to?( method_name ) end |