Class: CounterAdapter

Inherits:
DataMapper::Adapters::AbstractAdapter show all
Defined in:
lib/dm-core/spec/lib/counter_adapter.rb

Instance Attribute Summary (collapse)

Attributes inherited from DataMapper::Adapters::AbstractAdapter

#field_naming_convention, #name, #options, #resource_naming_convention

Instance Method Summary (collapse)

Methods inherited from DataMapper::Adapters::AbstractAdapter

#attributes_as_fields, #create, #delete, descendants, inherited, #initialize_serial, #new_query, #read, #update

Methods included from DataMapper::Equalizer

#equalize

Methods included from DataMapper::Assertions

#assert_kind_of

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

- (Object) method_missing(method, *args, &block) (private)



34
35
36
37
# File 'lib/dm-core/spec/lib/counter_adapter.rb', line 34

def method_missing(method, *args, &block)
  increment_count_for(method)
  @adapter.send(method, *args, &block)
end

Instance Attribute Details

- (Object) counts (readonly)

Returns the value of attribute counts



8
9
10
# File 'lib/dm-core/spec/lib/counter_adapter.rb', line 8

def counts
  @counts
end

Instance Method Details

- (Boolean) instance_of?(klass)

Returns:

  • (Boolean)


14
15
16
# File 'lib/dm-core/spec/lib/counter_adapter.rb', line 14

def instance_of?(klass)
  super || @adapter.instance_of?(klass)
end

- (Boolean) kind_of?(klass)

Returns:

  • (Boolean)


10
11
12
# File 'lib/dm-core/spec/lib/counter_adapter.rb', line 10

def kind_of?(klass)
  super || @adapter.kind_of?(klass)
end

- (Boolean) respond_to?(method, include_private = false)

Returns:

  • (Boolean)


18
19
20
# File 'lib/dm-core/spec/lib/counter_adapter.rb', line 18

def respond_to?(method, include_private = false)
  super || @adapter.respond_to?(method, include_private)
end