Class: Workarea::Catalog::CleanDetails

Inherits:
Object
  • Object
show all
Defined in:
app/models/workarea/catalog/clean_details.rb

Instance Method Summary collapse

Constructor Details

#initialize(dirty) ⇒ CleanDetails

Returns a new instance of CleanDetails.



4
5
6
# File 'app/models/workarea/catalog/clean_details.rb', line 4

def initialize(dirty)
  @dirty = dirty
end

Instance Method Details

#cleanedObject



8
9
10
11
12
13
14
15
# File 'app/models/workarea/catalog/clean_details.rb', line 8

def cleaned
  tuples = @dirty.map do |key, value|
    next if key.blank? || value.blank?
    [key, Array.wrap(value)]
  end

  Hash[tuples.compact]
end