Class: Datamappify::Lazy::SourceAttributesWalker
- Inherits:
-
Repository::QueryMethod::Method::SourceAttributesWalker
- Object
- Repository::QueryMethod::Method::SourceAttributesWalker
- Datamappify::Lazy::SourceAttributesWalker
- Defined in:
- lib/datamappify/lazy/source_attributes_walker.rb
Instance Method Summary collapse
- #default_source_class?(source_class) ⇒ Boolean private
- #do_walk?(source_class, attributes) ⇒ Boolean private
-
#read_only? ⇒ Boolean
private
Whether the walker is in read-only mode, it is determined from the query method if available.
- #walk_performed(attributes) ⇒ void private
Methods inherited from Repository::QueryMethod::Method::SourceAttributesWalker
#check_dirty?, #dirty?, #execute, #initialize
Constructor Details
This class inherits a constructor from Datamappify::Repository::QueryMethod::Method::SourceAttributesWalker
Instance Method Details
#default_source_class?(source_class) ⇒ Boolean (private)
36 37 38 |
# File 'lib/datamappify/lazy/source_attributes_walker.rb', line 36 def default_source_class?(source_class) @entity.repository.data_mapper.default_source_class == source_class end |
#do_walk?(source_class, attributes) ⇒ Boolean (private)
13 14 15 |
# File 'lib/datamappify/lazy/source_attributes_walker.rb', line 13 def do_walk?(source_class, attributes) read_only? ? default_source_class?(source_class) : true end |
#read_only? ⇒ Boolean (private)
Whether the walker is in read-only mode, it is determined from the query method if available
44 45 46 |
# File 'lib/datamappify/lazy/source_attributes_walker.rb', line 44 def read_only? !!@query_method && @query_method.reader? end |
#walk_performed(attributes) ⇒ void (private)
This method returns an undefined value.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/datamappify/lazy/source_attributes_walker.rb', line 22 def walk_performed(attributes) attributes.each do |attribute| @entity.cached_attributes[attribute.key] = attribute.value end @entity.changed @entity.notify_observers(@query_method, attributes) super end |