Class: RespondForHelper::Lookups::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/respond_for_helper/lookups/format.rb

Instance Method Summary collapse

Constructor Details

#initialize(controller, options) ⇒ Format

Returns a new instance of Format.



6
7
8
9
10
11
# File 'lib/respond_for_helper/lookups/format.rb', line 6

def initialize(controller, options)
  @controller = controller
  @options = options

  @controller_config = @controller.class.respond_for_config
end

Instance Method Details

#callObject



13
14
15
16
17
# File 'lib/respond_for_helper/lookups/format.rb', line 13

def call
  formats = adjust_formats(resolve_formats.deep_dup)
  formatters = resolve_formatters
  formatters.select { |format, _| formats.include?(format) }.to_h
end