Sha256: 60d44debfc90cae66430d821eef12e658a129be402e3349e7d1492669725a534

Contents?: true

Size: 998 Bytes

Versions: 33

Compression:

Stored size: 998 Bytes

Contents

module ActivityNotification
  # Common module included in acts_as module.
  # Provides methods to extract parameters.
  module ActsAsCommon
    extend ActiveSupport::Concern

    class_methods do
      protected
        # Sets acts_as parameters.
        # @api protected
        def set_acts_as_parameters(option_list, options, field_prefix = "")
          option_list.map { |key|
            options[key] ?
              [key, self.send("_#{field_prefix}#{key}=".to_sym, options.delete(key))] : [nil, nil]
          }.to_h.delete_if { |k, _| k.nil? }
        end
  
        # Sets acts_as parameters for target.
        # @api protected
        def set_acts_as_parameters_for_target(target_type, option_list, options, field_prefix = "")
          option_list.map { |key|
            options[key] ?
              [key, self.send("_#{field_prefix}#{key}".to_sym).store(target_type.to_sym, options.delete(key))] : [nil, nil]
          }.to_h.delete_if { |k, _| k.nil? }
        end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
activity_notification-2.3.3 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.3.2 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.3.1 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.3.0 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.2.4 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.2.3 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.2.2 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.2.1 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.2.0 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.1.4 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.1.3 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.1.2 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.1.1 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.1.0 lib/activity_notification/roles/acts_as_common.rb
activity_notification-2.0.0 lib/activity_notification/roles/acts_as_common.rb
activity_notification-1.7.1 lib/activity_notification/roles/acts_as_common.rb
activity_notification-1.7.0 lib/activity_notification/roles/acts_as_common.rb
activity_notification-1.6.1 lib/activity_notification/roles/acts_as_common.rb
activity_notification-1.6.0 lib/activity_notification/roles/acts_as_common.rb
activity_notification-1.5.1 lib/activity_notification/roles/acts_as_common.rb