Class: ActiverecordCursorPagination::ClassFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord_cursor_pagination/class_formatter.rb

Instance Method Summary collapse

Instance Method Details

#format(klass_or_name) ⇒ String?

Format the class name

Parameters:

  • klass_or_name (String, Symbol, Class)

Returns:

  • (String, nil)

    The formatted class name



9
10
11
12
13
14
15
16
17
# File 'lib/activerecord_cursor_pagination/class_formatter.rb', line 9

def format(klass_or_name)
  if klass_or_name.nil? || klass_or_name.is_a?(String)
    klass_or_name
  elsif klass_or_name.is_a? Symbol
    klass_or_name.to_s.camelcase
  else
    klass_or_name.name
  end
end