class ContentService
A layer of higher level methods on top of Content
Public Class Methods
blacklisted_fields()
click to toggle source
TODO: make this smarter
# File lib/serendipitous/content_service.rb, line 23 def self.blacklisted_fields @blacklisted_fields ||= %w(id user_id) end
unanswered?(field)
click to toggle source
# File lib/serendipitous/content_service.rb, line 12 def self.unanswered?(field) # TODO: Compare against defaults field.nil? || field.length == 0 end
unanswered_fields(content)
click to toggle source
# File lib/serendipitous/content_service.rb, line 3 def self.unanswered_fields(content) content.data.select do |key, value| next if blacklisted_fields.include? key #next unless whitelisted_fields.include? key unanswered?(value) end end
whitelisted_fields()
click to toggle source
TODO: make this smarter
# File lib/serendipitous/content_service.rb, line 18 def self.whitelisted_fields @whitelisted_fields ||= %w(name description) end