Class: ModelScope::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/modelscope/runner.rb

Constant Summary collapse

DEFAULT_FORMAT =
:table

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(format:, model:, paths:, kind: :callbacks) ⇒ Runner

Returns a new instance of Runner.



11
12
13
14
15
16
# File 'lib/modelscope/runner.rb', line 11

def initialize(format:, model:, paths:, kind: :callbacks)
  @format = (format || DEFAULT_FORMAT).to_sym
  @model_name = model
  @paths = paths
  @kind = kind
end

Class Method Details

.run(format: DEFAULT_FORMAT, model: nil, paths: nil, kind: :callbacks) ⇒ Object



7
8
9
# File 'lib/modelscope/runner.rb', line 7

def self.run(format: DEFAULT_FORMAT, model: nil, paths: nil, kind: :callbacks)
  new(format: format, model: model, paths: paths, kind: kind).run
end

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
# File 'lib/modelscope/runner.rb', line 18

def run
  if @kind == :report
    [:callbacks, :validations].map do |ckind|
      generate_report(collect_callbacks(ckind), ckind)
    end.join("\n\n")
  else
    generate_report(collect_callbacks(@kind), @kind)
  end
end