Class: TrailGuide::Adapters::Participants::Base::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/trail_guide/adapters/participants/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, config) ⇒ Adapter

Returns a new instance of Adapter.



26
27
28
29
# File 'lib/trail_guide/adapters/participants/base.rb', line 26

def initialize(context, config)
  @context = context
  @config = config
end

Instance Attribute Details

#configObject (readonly) Also known as: configuration

Returns the value of attribute config.



23
24
25
# File 'lib/trail_guide/adapters/participants/base.rb', line 23

def config
  @config
end

#contextObject (readonly)

Returns the value of attribute context.



23
24
25
# File 'lib/trail_guide/adapters/participants/base.rb', line 23

def context
  @context
end

Instance Method Details

#[](key) ⇒ Object

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/trail_guide/adapters/participants/base.rb', line 36

def [](key)
  raise NotImplementedError, "You must override the `[]` method in your inheriting adapter class"
end

#[]=(key, value) ⇒ Object

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/trail_guide/adapters/participants/base.rb', line 40

def []=(key, value)
  raise NotImplementedError, "You must override the `[]=` method in your inheriting adapter class"
end

#delete(key) ⇒ Object

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/trail_guide/adapters/participants/base.rb', line 44

def delete(key)
  raise NotImplementedError, "You must override the `delete` method in your inheriting adapter class"
end

#destroy!Object

Raises:

  • (NotImplementedError)


48
49
50
# File 'lib/trail_guide/adapters/participants/base.rb', line 48

def destroy!
  raise NotImplementedError, "You must override the `destroy!` method in your inheriting adapter class"
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/trail_guide/adapters/participants/base.rb', line 56

def key?(key)
  raise NotImplementedError, "You must override the `key?` method in your inheriting adapter class"
end

#keysObject

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/trail_guide/adapters/participants/base.rb', line 52

def keys
  raise NotImplementedError, "You must override the `keys` method in your inheriting adapter class"
end

#subjectObject Also known as: user



31
32
33
# File 'lib/trail_guide/adapters/participants/base.rb', line 31

def subject
  context.try(:trailguide_user) || context.try(:current_user)
end

#to_hObject

Raises:

  • (NotImplementedError)


60
61
62
# File 'lib/trail_guide/adapters/participants/base.rb', line 60

def to_h
  raise NotImplementedError, "You must override the `to_h` method in your inheriting adapter class"
end