Class: Datamappify::Lazy::SourceAttributesWalker

Inherits:
Repository::QueryMethod::Method::SourceAttributesWalker show all
Defined in:
lib/datamappify/lazy/source_attributes_walker.rb

Instance Method Summary collapse

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)

Parameters:

  • source_class (Class)

Returns:

  • (Boolean)


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)

Parameters:

Returns:

  • (Boolean)
  • (Boolean)

See Also:



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

Returns:

  • (Boolean)


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