Class: GitlabJanitor::BaseCleaner::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab_janitor/base_cleaner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ Model

Returns a new instance of Model.



8
9
10
# File 'lib/gitlab_janitor/base_cleaner.rb', line 8

def initialize(model)
  @model = model
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



12
13
14
15
16
# File 'lib/gitlab_janitor/base_cleaner.rb', line 12

def method_missing(method, *args, &block)
  super unless model.respond_to?(method)

  model.send(method, *args, &block)
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



6
7
8
# File 'lib/gitlab_janitor/base_cleaner.rb', line 6

def model
  @model
end

Instance Method Details

#respond_to?(*args) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/gitlab_janitor/base_cleaner.rb', line 18

def respond_to?(*args)
  model.send(:respond_to?, *args) || super
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/gitlab_janitor/base_cleaner.rb', line 22

def respond_to_missing?(method_name, include_private = false)
  model.send(:respond_to_missing?, method_name, include_private) || super
end