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.



30
31
32
# File 'lib/rack/scaffold/adapters.rb', line 30

def initialize(klass)
  @klass = klass
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *_args) ⇒ Object



86
87
88
# File 'lib/rack/scaffold/adapters.rb', line 86

def method_missing(method, *_args)
  @klass.send(method)
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



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

def klass
  @klass
end

Class Method Details

.===(_model) ⇒ Object



21
22
23
# File 'lib/rack/scaffold/adapters.rb', line 21

def ===(_model)
  raise NotImplementedError
end

.inherited(adapter) ⇒ Object



16
17
18
19
# File 'lib/rack/scaffold/adapters.rb', line 16

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

.resources(_model, _options = {}) ⇒ Object



25
26
27
# File 'lib/rack/scaffold/adapters.rb', line 25

def resources(_model, _options = {})
  raise NotImplementedError
end

Instance Method Details

#[](_id) ⇒ Object



54
55
56
# File 'lib/rack/scaffold/adapters.rb', line 54

def [](_id)
  raise NotImplementedError
end

#allObject



46
47
48
# File 'lib/rack/scaffold/adapters.rb', line 46

def all
  raise NotImplementedError
end

#countObject



42
43
44
# File 'lib/rack/scaffold/adapters.rb', line 42

def count
  raise NotImplementedError
end

#create!(_attributes = {}) ⇒ Object



66
67
68
# File 'lib/rack/scaffold/adapters.rb', line 66

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

#destroy!Object



74
75
76
# File 'lib/rack/scaffold/adapters.rb', line 74

def destroy!
  raise NotImplementedError
end

#find(_options = {}) ⇒ Object



62
63
64
# File 'lib/rack/scaffold/adapters.rb', line 62

def find(_options = {})
  raise NotImplementedError
end

#one_to_many_associationsObject



58
59
60
# File 'lib/rack/scaffold/adapters.rb', line 58

def one_to_many_associations
  raise NotImplementedError
end

#paginate(_offset, _limit) ⇒ Object



50
51
52
# File 'lib/rack/scaffold/adapters.rb', line 50

def paginate(_offset, _limit)
  raise NotImplementedError
end

#pluralObject



38
39
40
# File 'lib/rack/scaffold/adapters.rb', line 38

def plural
  raise NotImplementedError
end

#singularObject



34
35
36
# File 'lib/rack/scaffold/adapters.rb', line 34

def singular
  raise NotImplementedError
end

#timestamps?Boolean

Returns:

  • (Boolean)

Raises:



78
79
80
# File 'lib/rack/scaffold/adapters.rb', line 78

def timestamps?
  raise NotImplementedError
end

#update!(_attributes = {}) ⇒ Object



70
71
72
# File 'lib/rack/scaffold/adapters.rb', line 70

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

#update_timestamp_fieldObject



82
83
84
# File 'lib/rack/scaffold/adapters.rb', line 82

def update_timestamp_field
  raise NotImplementedError
end