Class: AddMetric
- Inherits:
-
Struct
- Object
- Struct
- AddMetric
- Defined in:
- lib/commands/add_metric.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #call(project = project, metric = metric) ⇒ Object
- #metric(metric_class = metric_class, name = name) ⇒ Object
- #metric_class(type = type) ⇒ Object
- #project(project_name = project_name) ⇒ Object
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
1 2 3 |
# File 'lib/commands/add_metric.rb', line 1 def name @name end |
#project_name ⇒ Object
Returns the value of attribute project_name
1 2 3 |
# File 'lib/commands/add_metric.rb', line 1 def project_name @project_name end |
#type ⇒ Object
Returns the value of attribute type
1 2 3 |
# File 'lib/commands/add_metric.rb', line 1 def type @type end |
Instance Method Details
#call(project = project, metric = metric) ⇒ Object
2 3 4 |
# File 'lib/commands/add_metric.rb', line 2 def call project = project, metric = metric project.add_metric(metric) end |
#metric(metric_class = metric_class, name = name) ⇒ Object
10 11 12 |
# File 'lib/commands/add_metric.rb', line 10 def metric metric_class = metric_class, name = name metric_class.new name: name end |
#metric_class(type = type) ⇒ Object
14 15 16 |
# File 'lib/commands/add_metric.rb', line 14 def metric_class type = type "#{type}Metric".classify.constantize end |
#project(project_name = project_name) ⇒ Object
6 7 8 |
# File 'lib/commands/add_metric.rb', line 6 def project project_name = project_name Project.find_by(name: project_name) end |