Class: MediaTypes::Formatter

Inherits:
Hash
  • Object
show all
Defined in:
lib/media_types/formatter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Hash

#===, #class, #slice

Class Method Details

.call(*args, **options) ⇒ Object



9
10
11
# File 'lib/media_types/formatter.rb', line 9

def call(*args, **options)
  new(*args, **options).call
end

Instance Method Details

#callObject



14
15
16
17
18
19
# File 'lib/media_types/formatter.rb', line 14

def call
  filtered_arguments = arguments
  return template if MediaTypes::Object.new(filtered_arguments).empty?

  format(rework_template(filtered_arguments), filtered_arguments)
end