Sha256: 139a508bf1cab185308262e9f1680c26b8dc26f930cb7af97b3351b0385e61a4

Contents?: true

Size: 404 Bytes

Versions: 10

Compression:

Stored size: 404 Bytes

Contents

class AddMetric < Struct.new :project_name, :type, :name
  def call project = project, metric = metric
    project.add_metric(metric)
  end

  def project project_name = project_name
    Project.find_by(name: project_name)
  end

  def metric metric_class = metric_class, name = name
    metric_class.new name: name
  end

  def metric_class type = type
    "#{type}Metric".classify.constantize
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
techcor-0.0.10 lib/commands/add_metric.rb
techcor-0.0.9 lib/commands/add_metric.rb
techcor-0.0.8 lib/commands/add_metric.rb
techcor-0.0.7 lib/commands/add_metric.rb
techcor-0.0.6 lib/commands/add_metric.rb
techcor-0.0.5 lib/commands/add_metric.rb
techcor-0.0.4 lib/commands/add_metric.rb
techcor-0.0.3 lib/commands/add_metric.rb
techcor-0.0.2 lib/commands/add_metric.rb
techcor-0.0.1 lib/commands/add_metric.rb