Class: Rack::Scaffold::Adapters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/scaffold/adapters.rb

Direct Known Subclasses

ActiveRecord, Sequel

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Base

Returns a new instance of Base.



28
29
30
# File 'lib/rack/scaffold/adapters.rb', line 28

def initialize(klass)
  @klass = klass
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



84
85
86
# File 'lib/rack/scaffold/adapters.rb', line 84

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

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



11
12
13
# File 'lib/rack/scaffold/adapters.rb', line 11

def klass
  @klass
end

Class Method Details

.===(model) ⇒ Object



19
20
21
# File 'lib/rack/scaffold/adapters.rb', line 19

def ===(model)
  raise NotImplementedError
end

.inherited(adapter) ⇒ Object



14
15
16
17
# File 'lib/rack/scaffold/adapters.rb', line 14

def inherited(adapter)
  ::Rack::Scaffold.adapters << adapter
  super
end

.resources(model, options = {}) ⇒ Object



23
24
25
# File 'lib/rack/scaffold/adapters.rb', line 23

def resources(model, options = {})
  raise NotImplementedError
end

Instance Method Details

#[](id) ⇒ Object



52
53
54
# File 'lib/rack/scaffold/adapters.rb', line 52

def [](id)
  raise NotImplementedError
end

#allObject



44
45
46
# File 'lib/rack/scaffold/adapters.rb', line 44

def all
  raise NotImplementedError
end

#countObject



40
41
42
# File 'lib/rack/scaffold/adapters.rb', line 40

def count
  raise NotImplementedError
end

#create!(attributes = {}) ⇒ Object



64
65
66
# File 'lib/rack/scaffold/adapters.rb', line 64

def create!(attributes = {})
  raise NotImplementedError
end

#destroy!Object



72
73
74
# File 'lib/rack/scaffold/adapters.rb', line 72

def destroy!
  raise NotImplementedError
end

#find(options = {}) ⇒ Object



60
61
62
# File 'lib/rack/scaffold/adapters.rb', line 60

def find(options = {})
  raise NotImplementedError
end

#one_to_many_associationsObject



56
57
58
# File 'lib/rack/scaffold/adapters.rb', line 56

def one_to_many_associations
  raise NotImplementedError
end

#paginate(offset, limit) ⇒ Object



48
49
50
# File 'lib/rack/scaffold/adapters.rb', line 48

def paginate(offset, limit)
  raise NotImplementedError
end

#pluralObject



36
37
38
# File 'lib/rack/scaffold/adapters.rb', line 36

def plural
  raise NotImplementedError
end

#singularObject



32
33
34
# File 'lib/rack/scaffold/adapters.rb', line 32

def singular
  raise NotImplementedError
end

#timestamps?Boolean

Returns:

  • (Boolean)

Raises:



76
77
78
# File 'lib/rack/scaffold/adapters.rb', line 76

def timestamps?
  raise NotImplementedError
end

#update!(attributes = {}) ⇒ Object



68
69
70
# File 'lib/rack/scaffold/adapters.rb', line 68

def update!(attributes = {})
  raise NotImplementedError
end

#update_timestamp_fieldObject



80
81
82
# File 'lib/rack/scaffold/adapters.rb', line 80

def update_timestamp_field
  raise NotImplementedError
end