Class: Aggeratio::Aggregator

Inherits:
Object
  • Object
show all
Defined in:
lib/aggeratio/aggregator.rb

Overview

Main base class for aggregators

Constant Summary collapse

@@parameters =
{}
@@aggregator_name =
'Aggregator'
@@category =
'none'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.aggregator_nameObject

Raises:

  • (NotImplementedError)

15
16
17
# File 'lib/aggeratio/aggregator.rb', line 15

def aggregator_name
  raise NotImplementedError
end

.categoryObject

Raises:

  • (NotImplementedError)

19
20
21
# File 'lib/aggeratio/aggregator.rb', line 19

def category
  raise NotImplementedError
end

.human_nameObject


23
24
25
26
# File 'lib/aggeratio/aggregator.rb', line 23

def human_name
  name = aggregator_name
  ::I18n.t("aggregators.#{name}.name", default: [:"nomenclatures.document_natures.items.#{name}", :"labels.#{name}", name.to_s.humanize])
end

.parametersObject

Raises:

  • (NotImplementedError)

11
12
13
# File 'lib/aggeratio/aggregator.rb', line 11

def parameters
  raise NotImplementedError
end

Instance Method Details

#keyObject


41
42
43
44
45
# File 'lib/aggeratio/aggregator.rb', line 41

def key
  # raise NotImplementedError.new
  Rails.logger.warn("Aggregator #{self.class.aggregator_name} should have its own :key method")
  rand(1_000_000).to_s(36)
end

#to_document_fragment(*_args) ⇒ Object

Raises:

  • (NotImplementedError)

33
34
35
# File 'lib/aggeratio/aggregator.rb', line 33

def to_document_fragment(*_args)
  raise NotImplementedError
end

#to_json(*_args) ⇒ Object

Raises:

  • (NotImplementedError)

37
38
39
# File 'lib/aggeratio/aggregator.rb', line 37

def to_json(*_args)
  raise NotImplementedError
end

#to_xml(*_args) ⇒ Object

Raises:

  • (NotImplementedError)

29
30
31
# File 'lib/aggeratio/aggregator.rb', line 29

def to_xml(*_args)
  raise NotImplementedError
end