Sha256: 90bb6872cc47ed3301fdf3a56822942ed6e15c6dda6a5858489caca3c1c26e0e

Contents?: true

Size: 380 Bytes

Versions: 5

Compression:

Stored size: 380 Bytes

Contents

module Workarea
  decorate Storefront::UserViewModel, with: :mail_chimp do
    def has_email_interest?(interest)
      return false if model.groups.empty?
      email_interests.find { |id, int| int == interest }
    end

    def email_interests
      model.groups.map(&:interests).inject(&:merge)
    end

    def email_signup?
      model.email_signup || super
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
workarea-mail_chimp-3.1.0 app/view_models/workarea/storefront/user_view_model.decorator
workarea-mail_chimp-3.0.5 app/view_models/workarea/storefront/user_view_model.decorator
workarea-mail_chimp-3.0.4 app/view_models/workarea/storefront/user_view_model.decorator
workarea-mail_chimp-3.0.3 app/view_models/workarea/storefront/user_view_model.decorator
workarea-mail_chimp-3.0.2 app/view_models/workarea/storefront/user_view_model.decorator