Class: ForemanStatistics::Trend

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/foreman_statistics/trend.rb

Direct Known Subclasses

FactTrend, ForemanTrend

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build_trend(trend_params = {}) ⇒ Object



27
28
29
30
31
# File 'app/models/foreman_statistics/trend.rb', line 27

def self.build_trend(trend_params = {})
  params = trend_params.dup
  params[:trendable_type] = 'ForemanPuppet::Environment' if params[:trendable_type] == 'Environment'
  params[:trendable_type] == 'FactName' ? FactTrend.new(params) : ForemanTrend.new(params)
end

.humanize_class_name(_name = nil) ⇒ Object



23
24
25
# File 'app/models/foreman_statistics/trend.rb', line 23

def self.humanize_class_name(_name = nil)
  super('Trend')
end

.title_nameObject



19
20
21
# File 'app/models/foreman_statistics/trend.rb', line 19

def self.title_name
  'label'.freeze
end

Instance Method Details

#to_paramObject



15
16
17
# File 'app/models/foreman_statistics/trend.rb', line 15

def to_param
  Parameterizable.parameterize("#{id}-#{to_label}")
end