Module: Ixtlan::DataMapper::OptimisticGet

Defined in:
lib/ixtlan/datamapper/optimistic_get.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



26
27
28
# File 'lib/ixtlan/datamapper/optimistic_get.rb', line 26

def self.included(base)
  base.extend OptimisticGet
end

Instance Method Details

#optimistic_get(updated_at, *args) ⇒ Object



32
33
34
35
36
37
# File 'lib/ixtlan/datamapper/optimistic_get.rb', line 32

def optimistic_get(updated_at, *args) 
  result = get( *args )
  if result
    check_stale( updated_at, result )
  end
end

#optimistic_get!(updated_at, *args) ⇒ Object



39
40
41
42
# File 'lib/ixtlan/datamapper/optimistic_get.rb', line 39

def optimistic_get!(updated_at, *args)
  result = get!( *args )
  check_stale( updated_at, result )
end