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::Assertions

#assert_kind_of

Methods included from DataMapper::Equalizer

#equalize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (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

#countsObject (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

#instance_of?(klass) ⇒ Boolean

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

#kind_of?(klass) ⇒ Boolean

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

#respond_to?(method, include_private = false) ⇒ Boolean

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