Class: Algolia::NormalizeId

Inherits:
ApplicationService show all
Defined in:
lib/storage/algolia/normalize_id.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationService

process

Constructor Details

#initialize(data) ⇒ NormalizeId

Returns a new instance of NormalizeId.



9
10
11
# File 'lib/storage/algolia/normalize_id.rb', line 9

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'lib/storage/algolia/normalize_id.rb', line 7

def data
  @data
end

Instance Method Details

#processObject



13
14
15
16
17
# File 'lib/storage/algolia/normalize_id.rb', line 13

def process
  data.kind_of?(Array) ?
    data.map { |node| objectid_to_id(node) }.to_hashugar :
    objectid_to_id(data)
end