Class: Minato::Utils::BaseCommand::Index

Inherits:
Object
  • Object
show all
Includes:
SimpleCommand
Defined in:
lib/minato/utils/base_command/index.rb

Instance Method Summary collapse

Constructor Details

#initialize(model_class, filters = {}) ⇒ Index

Returns a new instance of Index.



9
10
11
12
# File 'lib/minato/utils/base_command/index.rb', line 9

def initialize(model_class, filters = {})
  @model_class = model_class
  @filters = filters
end

Instance Method Details

#callObject



14
15
16
17
18
# File 'lib/minato/utils/base_command/index.rb', line 14

def call
  return @model_class.where(@filters) if @filters.present?

  @model_class.all
end