class CatToColFilter

Public Class Methods

new(mapping) click to toggle source
# File lib/synchrograph/filters/categories_to_colours.rb, line 3
def initialize(mapping)
  @mapping = mapping
end

Public Instance Methods

call(ical_event, representation) click to toggle source
# File lib/synchrograph/filters/categories_to_colours.rb, line 7
def call(ical_event, representation)
  @mapping.each_pair do |cat, col|
    representation['colorId'] = col.to_s if ical_event.categories.flatten.any? {|c| c.to_sym == cat}
  end
  representation
end