Class: ActiveRecordCustomPreloader::PreloadWithOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record_custom_preloader/preload_with_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ PreloadWithOptions

Returns a new instance of PreloadWithOptions.



4
5
6
7
# File 'lib/active_record_custom_preloader/preload_with_options.rb', line 4

def initialize(name, options = {})
  @name = name
  @options = options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/active_record_custom_preloader/preload_with_options.rb', line 3

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/active_record_custom_preloader/preload_with_options.rb', line 3

def options
  @options
end

Instance Method Details

#loader_for(klass) ⇒ Object



9
10
11
# File 'lib/active_record_custom_preloader/preload_with_options.rb', line 9

def loader_for(klass)
  klass.custom_loader_for(name, options)
end