class Datamappify::Lazy::SourceAttributesWalker

Private Instance Methods

default_source_class?(source_class) click to toggle source

@param source_class [Class]

@return [Boolean]

# 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) click to toggle source

@param (see Repository::QueryMethod::Method::SourceAttributesWalker#do_walk?)

@see Repository::QueryMethod::Method::SourceAttributesWalker#do_walk?

@return (see Repository::QueryMethod::Method::SourceAttributesWalker#do_walk?)

# 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?() click to toggle source

Whether the walker is in read-only mode, it is determined from the {Repository::QueryMethod::Method query method} if available

@return [Boolean]

# File lib/datamappify/lazy/source_attributes_walker.rb, line 44
def read_only?
  !!@query_method && @query_method.reader?
end
walk_performed(attributes) click to toggle source

@param (see Repository::QueryMethod::Method::SourceAttributesWalker#walk_performed)

@see Repository::QueryMethod::Method::SourceAttributesWalker#walk_performed

@return (see Repository::QueryMethod::Method::SourceAttributesWalker#walk_performed)

Calls superclass method
# 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