repo
stringlengths
5
58
path
stringlengths
9
168
func_name
stringlengths
9
130
original_string
stringlengths
66
10.5k
language
stringclasses
1 value
code
stringlengths
66
10.5k
code_tokens
list
docstring
stringlengths
8
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
94
266
partition
stringclasses
1 value
simukappu/activity_notification
lib/activity_notification/apis/notification_api.rb
ActivityNotification.NotificationApi.send_notification_email
def send_notification_email(options = {}) if target.notification_email_allowed?(notifiable, key) && notifiable.notification_email_allowed?(target, key) && email_subscribed? send_later = options.has_key?(:send_later) ? options[:send_later] : true send_later ? @@notificat...
ruby
def send_notification_email(options = {}) if target.notification_email_allowed?(notifiable, key) && notifiable.notification_email_allowed?(target, key) && email_subscribed? send_later = options.has_key?(:send_later) ? options[:send_later] : true send_later ? @@notificat...
[ "def", "send_notification_email", "(", "options", "=", "{", "}", ")", "if", "target", ".", "notification_email_allowed?", "(", "notifiable", ",", "key", ")", "&&", "notifiable", ".", "notification_email_allowed?", "(", "target", ",", "key", ")", "&&", "email_sub...
Sends notification email to the target. @param [Hash] options Options for notification email @option options [Boolean] :send_later If it sends notification email asynchronously @option options [String, Symbol] :fallback (:default) Fallback template to use when MissingTemplate is raised @return ...
[ "Sends", "notification", "email", "to", "the", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L435-L444
train
simukappu/activity_notification
lib/activity_notification/apis/notification_api.rb
ActivityNotification.NotificationApi.publish_to_optional_targets
def publish_to_optional_targets(options = {}) notifiable.optional_targets(target.to_resources_name, key).map { |optional_target| optional_target_name = optional_target.to_optional_target_name if optional_target_subscribed?(optional_target_name) optional_target.notify(self, options[option...
ruby
def publish_to_optional_targets(options = {}) notifiable.optional_targets(target.to_resources_name, key).map { |optional_target| optional_target_name = optional_target.to_optional_target_name if optional_target_subscribed?(optional_target_name) optional_target.notify(self, options[option...
[ "def", "publish_to_optional_targets", "(", "options", "=", "{", "}", ")", "notifiable", ".", "optional_targets", "(", "target", ".", "to_resources_name", ",", "key", ")", ".", "map", "{", "|", "optional_target", "|", "optional_target_name", "=", "optional_target",...
Publishes notification to the optional targets. @param [Hash] options Options for optional targets @return [Hash] Result of publishing to optional target
[ "Publishes", "notification", "to", "the", "optional", "targets", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L450-L460
train
simukappu/activity_notification
lib/activity_notification/apis/notification_api.rb
ActivityNotification.NotificationApi.open!
def open!(options = {}) opened? and return 0 opened_at = options[:opened_at] || Time.current with_members = options.has_key?(:with_members) ? options[:with_members] : true unopened_member_count = with_members ? group_members.unopened_only.count : 0 group_members.update_all(opened_at: op...
ruby
def open!(options = {}) opened? and return 0 opened_at = options[:opened_at] || Time.current with_members = options.has_key?(:with_members) ? options[:with_members] : true unopened_member_count = with_members ? group_members.unopened_only.count : 0 group_members.update_all(opened_at: op...
[ "def", "open!", "(", "options", "=", "{", "}", ")", "opened?", "and", "return", "0", "opened_at", "=", "options", "[", ":opened_at", "]", "||", "Time", ".", "current", "with_members", "=", "options", ".", "has_key?", "(", ":with_members", ")", "?", "opti...
Opens the notification. @param [Hash] options Options for opening notifications @option options [DateTime] :opened_at (Time.current) Time to set to opened_at of the notification record @option options [Boolean] :with_members (true) If it opens notifications including group members @return [Integer] Numbe...
[ "Opens", "the", "notification", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L468-L476
train
simukappu/activity_notification
lib/activity_notification/apis/notification_api.rb
ActivityNotification.NotificationApi.group_notifier_count
def group_notifier_count(limit = ActivityNotification.config.opened_index_limit) notification = group_member? && group_owner.present? ? group_owner : self notification.notifier.present? ? group_member_notifier_count(limit) + 1 : 0 end
ruby
def group_notifier_count(limit = ActivityNotification.config.opened_index_limit) notification = group_member? && group_owner.present? ? group_owner : self notification.notifier.present? ? group_member_notifier_count(limit) + 1 : 0 end
[ "def", "group_notifier_count", "(", "limit", "=", "ActivityNotification", ".", "config", ".", "opened_index_limit", ")", "notification", "=", "group_member?", "&&", "group_owner", ".", "present?", "?", "group_owner", ":", "self", "notification", ".", "notifier", "."...
Returns count of group member notifiers including group owner notifier. It always returns 0 if group owner notifier is blank. This method is designed to cache group by query result to avoid N+1 call. @param [Integer] limit Limit to query for opened notifications @return [Integer] Count of group notifications inclu...
[ "Returns", "count", "of", "group", "member", "notifiers", "including", "group", "owner", "notifier", ".", "It", "always", "returns", "0", "if", "group", "owner", "notifier", "is", "blank", ".", "This", "method", "is", "designed", "to", "cache", "group", "by"...
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L561-L564
train
simukappu/activity_notification
lib/activity_notification/apis/notification_api.rb
ActivityNotification.NotificationApi.remove_from_group
def remove_from_group new_group_owner = group_members.earliest if new_group_owner.present? new_group_owner.update(group_owner_id: nil) group_members.update_all(group_owner_id: new_group_owner.id) end new_group_owner end
ruby
def remove_from_group new_group_owner = group_members.earliest if new_group_owner.present? new_group_owner.update(group_owner_id: nil) group_members.update_all(group_owner_id: new_group_owner.id) end new_group_owner end
[ "def", "remove_from_group", "new_group_owner", "=", "group_members", ".", "earliest", "if", "new_group_owner", ".", "present?", "new_group_owner", ".", "update", "(", "group_owner_id", ":", "nil", ")", "group_members", ".", "update_all", "(", "group_owner_id", ":", ...
Remove from notification group and make a new group owner. @return [Notificaion] New group owner instance of the notification group
[ "Remove", "from", "notification", "group", "and", "make", "a", "new", "group", "owner", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L578-L585
train
simukappu/activity_notification
lib/activity_notification/apis/notification_api.rb
ActivityNotification.NotificationApi.notifiable_path
def notifiable_path notifiable.present? or raise ActiveRecord::RecordNotFound.new("Couldn't find notifiable #{notifiable_type}") notifiable.notifiable_path(target_type, key) end
ruby
def notifiable_path notifiable.present? or raise ActiveRecord::RecordNotFound.new("Couldn't find notifiable #{notifiable_type}") notifiable.notifiable_path(target_type, key) end
[ "def", "notifiable_path", "notifiable", ".", "present?", "or", "raise", "ActiveRecord", "::", "RecordNotFound", ".", "new", "(", "\"Couldn't find notifiable #{notifiable_type}\"", ")", "notifiable", ".", "notifiable_path", "(", "target_type", ",", "key", ")", "end" ]
Returns notifiable_path to move after opening notification with notifiable.notifiable_path. @return [String] Notifiable path URL to move after opening notification
[ "Returns", "notifiable_path", "to", "move", "after", "opening", "notification", "with", "notifiable", ".", "notifiable_path", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/notification_api.rb#L590-L593
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.notifications_path_for
def notifications_path_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}notifications_path", options) : send("#{routing_scope(options)}#{target.to_resource_name}_notifications_path", target, options) end
ruby
def notifications_path_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}notifications_path", options) : send("#{routing_scope(options)}#{target.to_resource_name}_notifications_path", target, options) end
[ "def", "notifications_path_for", "(", "target", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"#{routing_scope(options)}notifications_path\"", ",", "option...
Returns notifications_path for the target @param [Object] target Target instance @param [Hash] params Request parameters @return [String] notifications_path for the target @todo Needs any other better implementation @todo Must handle devise namespace
[ "Returns", "notifications_path", "for", "the", "target" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L81-L86
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.notification_path_for
def notification_path_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}notification_path", notification, options) : send("#{routing_scope(options)}#{notification.target.to_resource_name}_notification_path", notificati...
ruby
def notification_path_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}notification_path", notification, options) : send("#{routing_scope(options)}#{notification.target.to_resource_name}_notification_path", notificati...
[ "def", "notification_path_for", "(", "notification", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"#{routing_scope(options)}notification_path\"", ",", "no...
Returns notification_path for the notification @param [Notification] notification Notification instance @param [Hash] params Request parameters @return [String] notification_path for the notification @todo Needs any other better implementation @todo Must handle devise namespace
[ "Returns", "notification_path", "for", "the", "notification" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L95-L100
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.move_notification_path_for
def move_notification_path_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("move_#{routing_scope(options)}notification_path", notification, options) : send("move_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_pa...
ruby
def move_notification_path_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("move_#{routing_scope(options)}notification_path", notification, options) : send("move_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_pa...
[ "def", "move_notification_path_for", "(", "notification", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"move_#{routing_scope(options)}notification_path\"", ...
Returns move_notification_path for the target of specified notification @param [Notification] notification Notification instance @param [Hash] params Request parameters @return [String] move_notification_path for the target @todo Needs any other better implementation @todo Must handle devise namespace
[ "Returns", "move_notification_path", "for", "the", "target", "of", "specified", "notification" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L109-L114
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.open_notification_path_for
def open_notification_path_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("open_#{routing_scope(options)}notification_path", notification, options) : send("open_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_pa...
ruby
def open_notification_path_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("open_#{routing_scope(options)}notification_path", notification, options) : send("open_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_pa...
[ "def", "open_notification_path_for", "(", "notification", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"open_#{routing_scope(options)}notification_path\"", ...
Returns open_notification_path for the target of specified notification @param [Notification] notification Notification instance @param [Hash] params Request parameters @return [String] open_notification_path for the target @todo Needs any other better implementation @todo Must handle devise namespace
[ "Returns", "open_notification_path", "for", "the", "target", "of", "specified", "notification" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L123-L128
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.open_all_notifications_path_for
def open_all_notifications_path_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("open_all_#{routing_scope(options)}notifications_path", options) : send("open_all_#{routing_scope(options)}#{target.to_resource_name}_notifications_path", target, optio...
ruby
def open_all_notifications_path_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("open_all_#{routing_scope(options)}notifications_path", options) : send("open_all_#{routing_scope(options)}#{target.to_resource_name}_notifications_path", target, optio...
[ "def", "open_all_notifications_path_for", "(", "target", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"open_all_#{routing_scope(options)}notifications_path\""...
Returns open_all_notifications_path for the target @param [Object] target Target instance @param [Hash] params Request parameters @return [String] open_all_notifications_path for the target @todo Needs any other better implementation @todo Must handle devise namespace
[ "Returns", "open_all_notifications_path", "for", "the", "target" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L137-L142
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.notifications_url_for
def notifications_url_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}notifications_url", options) : send("#{routing_scope(options)}#{target.to_resource_name}_notifications_url", target, options) end
ruby
def notifications_url_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}notifications_url", options) : send("#{routing_scope(options)}#{target.to_resource_name}_notifications_url", target, options) end
[ "def", "notifications_url_for", "(", "target", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"#{routing_scope(options)}notifications_url\"", ",", "options"...
Returns notifications_url for the target @param [Object] target Target instance @param [Hash] params Request parameters @return [String] notifications_url for the target @todo Needs any other better implementation @todo Must handle devise namespace
[ "Returns", "notifications_url", "for", "the", "target" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L151-L156
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.notification_url_for
def notification_url_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}notification_url", notification, options) : send("#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url", notification....
ruby
def notification_url_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}notification_url", notification, options) : send("#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url", notification....
[ "def", "notification_url_for", "(", "notification", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"#{routing_scope(options)}notification_url\"", ",", "noti...
Returns notification_url for the target of specified notification @param [Notification] notification Notification instance @param [Hash] params Request parameters @return [String] notification_url for the target @todo Needs any other better implementation @todo Must handle devise namespace
[ "Returns", "notification_url", "for", "the", "target", "of", "specified", "notification" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L165-L170
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.move_notification_url_for
def move_notification_url_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("move_#{routing_scope(options)}notification_url", notification, options) : send("move_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url"...
ruby
def move_notification_url_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("move_#{routing_scope(options)}notification_url", notification, options) : send("move_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url"...
[ "def", "move_notification_url_for", "(", "notification", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"move_#{routing_scope(options)}notification_url\"", ",...
Returns move_notification_url for the target of specified notification @param [Notification] notification Notification instance @param [Hash] params Request parameters @return [String] move_notification_url for the target @todo Needs any other better implementation @todo Must handle devise namespace
[ "Returns", "move_notification_url", "for", "the", "target", "of", "specified", "notification" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L179-L184
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.open_notification_url_for
def open_notification_url_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("open_#{routing_scope(options)}notification_url", notification, options) : send("open_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url"...
ruby
def open_notification_url_for(notification, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("open_#{routing_scope(options)}notification_url", notification, options) : send("open_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url"...
[ "def", "open_notification_url_for", "(", "notification", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"open_#{routing_scope(options)}notification_url\"", ",...
Returns open_notification_url for the target of specified notification @param [Notification] notification Notification instance @param [Hash] params Request parameters @return [String] open_notification_url for the target @todo Needs any other better implementation @todo Must handle devise namespace
[ "Returns", "open_notification_url", "for", "the", "target", "of", "specified", "notification" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L193-L198
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.open_all_notifications_url_for
def open_all_notifications_url_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("open_all_#{routing_scope(options)}notifications_url", options) : send("open_all_#{routing_scope(options)}#{target.to_resource_name}_notifications_url", target, options)...
ruby
def open_all_notifications_url_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("open_all_#{routing_scope(options)}notifications_url", options) : send("open_all_#{routing_scope(options)}#{target.to_resource_name}_notifications_url", target, options)...
[ "def", "open_all_notifications_url_for", "(", "target", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"open_all_#{routing_scope(options)}notifications_url\"", ...
Returns open_all_notifications_url for the target of specified notification @param [Target] target Target instance @param [Hash] params Request parameters @return [String] open_all_notifications_url for the target @todo Needs any other better implementation @todo Must handle devise namespace
[ "Returns", "open_all_notifications_url", "for", "the", "target", "of", "specified", "notification" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L207-L212
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.subscriptions_path_for
def subscriptions_path_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}subscriptions_path", options) : send("#{routing_scope(options)}#{target.to_resource_name}_subscriptions_path", target, options) end
ruby
def subscriptions_path_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}subscriptions_path", options) : send("#{routing_scope(options)}#{target.to_resource_name}_subscriptions_path", target, options) end
[ "def", "subscriptions_path_for", "(", "target", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"#{routing_scope(options)}subscriptions_path\"", ",", "option...
Returns subscriptions_path for the target @param [Object] target Target instance @param [Hash] params Request parameters @return [String] subscriptions_path for the target @todo Needs any other better implementation
[ "Returns", "subscriptions_path", "for", "the", "target" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L220-L225
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.subscription_path_for
def subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}subscription_path", subscription, options) : send("#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path", subscripti...
ruby
def subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}subscription_path", subscription, options) : send("#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path", subscripti...
[ "def", "subscription_path_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"#{routing_scope(options)}subscription_path\"", ",", "su...
Returns subscription_path for the subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_path for the subscription @todo Needs any other better implementation
[ "Returns", "subscription_path", "for", "the", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L233-L238
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.subscribe_subscription_path_for
def subscribe_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_#{routing_scope(options)}subscription_path", subscription, options) : send("subscribe_#{routing_scope(options)}#{subscription.target.to_resource_name}_...
ruby
def subscribe_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_#{routing_scope(options)}subscription_path", subscription, options) : send("subscribe_#{routing_scope(options)}#{subscription.target.to_resource_name}_...
[ "def", "subscribe_subscription_path_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"subscribe_#{routing_scope(options)}subscription_p...
Returns subscribe_subscription_path for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_path for the subscription @todo Needs any other better implementation
[ "Returns", "subscribe_subscription_path", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L246-L251
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.unsubscribe_subscription_path_for
def unsubscribe_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_#{routing_scope(options)}subscription_path", subscription, options) : send("unsubscribe_#{routing_scope(options)}#{subscription.target.to_resource_...
ruby
def unsubscribe_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_#{routing_scope(options)}subscription_path", subscription, options) : send("unsubscribe_#{routing_scope(options)}#{subscription.target.to_resource_...
[ "def", "unsubscribe_subscription_path_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"unsubscribe_#{routing_scope(options)}subscripti...
Returns unsubscribe_subscription_path for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_path for the subscription @todo Needs any other better implementation
[ "Returns", "unsubscribe_subscription_path", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L260-L265
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.subscribe_to_email_subscription_path_for
def subscribe_to_email_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_to_email_#{routing_scope(options)}subscription_path", subscription, options) : send("subscribe_to_email_#{routing_scope(options)}#{subscriptio...
ruby
def subscribe_to_email_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_to_email_#{routing_scope(options)}subscription_path", subscription, options) : send("subscribe_to_email_#{routing_scope(options)}#{subscriptio...
[ "def", "subscribe_to_email_subscription_path_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"subscribe_to_email_#{routing_scope(optio...
Returns subscribe_to_email_subscription_path for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_path for the subscription @todo Needs any other better implementation
[ "Returns", "subscribe_to_email_subscription_path", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L274-L279
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.unsubscribe_to_email_subscription_path_for
def unsubscribe_to_email_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_to_email_#{routing_scope(options)}subscription_path", subscription, options) : send("unsubscribe_to_email_#{routing_scope(options)}#{subsc...
ruby
def unsubscribe_to_email_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_to_email_#{routing_scope(options)}subscription_path", subscription, options) : send("unsubscribe_to_email_#{routing_scope(options)}#{subsc...
[ "def", "unsubscribe_to_email_subscription_path_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"unsubscribe_to_email_#{routing_scope(o...
Returns unsubscribe_to_email_subscription_path for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_path for the subscription @todo Needs any other better implementation
[ "Returns", "unsubscribe_to_email_subscription_path", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L288-L293
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.subscribe_to_optional_target_subscription_path_for
def subscribe_to_optional_target_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_to_optional_target_#{routing_scope(options)}subscription_path", subscription, options) : send("subscribe_to_optional_target_#{routin...
ruby
def subscribe_to_optional_target_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_to_optional_target_#{routing_scope(options)}subscription_path", subscription, options) : send("subscribe_to_optional_target_#{routin...
[ "def", "subscribe_to_optional_target_subscription_path_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"subscribe_to_optional_target_#...
Returns subscribe_to_optional_target_subscription_path for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_path for the subscription @todo Needs any other better implementation
[ "Returns", "subscribe_to_optional_target_subscription_path", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L302-L307
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.unsubscribe_to_optional_target_subscription_path_for
def unsubscribe_to_optional_target_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_to_optional_target_#{routing_scope(options)}subscription_path", subscription, options) : send("unsubscribe_to_optional_target_#{...
ruby
def unsubscribe_to_optional_target_subscription_path_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_to_optional_target_#{routing_scope(options)}subscription_path", subscription, options) : send("unsubscribe_to_optional_target_#{...
[ "def", "unsubscribe_to_optional_target_subscription_path_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"unsubscribe_to_optional_targ...
Returns unsubscribe_to_optional_target_subscription_path for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_path for the subscription @todo Needs any other better implementation
[ "Returns", "unsubscribe_to_optional_target_subscription_path", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L316-L321
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.subscriptions_url_for
def subscriptions_url_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}subscriptions_url", options) : send("#{routing_scope(options)}#{target.to_resource_name}_subscriptions_url", target, options) end
ruby
def subscriptions_url_for(target, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}subscriptions_url", options) : send("#{routing_scope(options)}#{target.to_resource_name}_subscriptions_url", target, options) end
[ "def", "subscriptions_url_for", "(", "target", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"#{routing_scope(options)}subscriptions_url\"", ",", "options"...
Returns subscriptions_url for the target @param [Object] target Target instance @param [Hash] params Request parameters @return [String] subscriptions_url for the target @todo Needs any other better implementation
[ "Returns", "subscriptions_url", "for", "the", "target" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L330-L335
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.subscription_url_for
def subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}subscription_url", subscription, options) : send("#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url", subscription....
ruby
def subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("#{routing_scope(options)}subscription_url", subscription, options) : send("#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url", subscription....
[ "def", "subscription_url_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"#{routing_scope(options)}subscription_url\"", ",", "subs...
Returns subscription_url for the subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_url for the subscription @todo Needs any other better implementation
[ "Returns", "subscription_url", "for", "the", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L343-L348
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.subscribe_subscription_url_for
def subscribe_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_#{routing_scope(options)}subscription_url", subscription, options) : send("subscribe_#{routing_scope(options)}#{subscription.target.to_resource_name}_su...
ruby
def subscribe_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_#{routing_scope(options)}subscription_url", subscription, options) : send("subscribe_#{routing_scope(options)}#{subscription.target.to_resource_name}_su...
[ "def", "subscribe_subscription_url_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"subscribe_#{routing_scope(options)}subscription_ur...
Returns subscribe_subscription_url for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_url for the subscription @todo Needs any other better implementation
[ "Returns", "subscribe_subscription_url", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L356-L361
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.unsubscribe_subscription_url_for
def unsubscribe_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_#{routing_scope(options)}subscription_url", subscription, options) : send("unsubscribe_#{routing_scope(options)}#{subscription.target.to_resource_na...
ruby
def unsubscribe_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_#{routing_scope(options)}subscription_url", subscription, options) : send("unsubscribe_#{routing_scope(options)}#{subscription.target.to_resource_na...
[ "def", "unsubscribe_subscription_url_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"unsubscribe_#{routing_scope(options)}subscriptio...
Returns unsubscribe_subscription_url for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_url for the subscription @todo Needs any other better implementation
[ "Returns", "unsubscribe_subscription_url", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L370-L375
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.subscribe_to_email_subscription_url_for
def subscribe_to_email_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_to_email_#{routing_scope(options)}subscription_url", subscription, options) : send("subscribe_to_email_#{routing_scope(options)}#{subscription....
ruby
def subscribe_to_email_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_to_email_#{routing_scope(options)}subscription_url", subscription, options) : send("subscribe_to_email_#{routing_scope(options)}#{subscription....
[ "def", "subscribe_to_email_subscription_url_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"subscribe_to_email_#{routing_scope(option...
Returns subscribe_to_email_subscription_url for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_url for the subscription @todo Needs any other better implementation
[ "Returns", "subscribe_to_email_subscription_url", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L384-L389
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.unsubscribe_to_email_subscription_url_for
def unsubscribe_to_email_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_to_email_#{routing_scope(options)}subscription_url", subscription, options) : send("unsubscribe_to_email_#{routing_scope(options)}#{subscri...
ruby
def unsubscribe_to_email_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_to_email_#{routing_scope(options)}subscription_url", subscription, options) : send("unsubscribe_to_email_#{routing_scope(options)}#{subscri...
[ "def", "unsubscribe_to_email_subscription_url_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"unsubscribe_to_email_#{routing_scope(op...
Returns unsubscribe_to_email_subscription_url for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_url for the subscription @todo Needs any other better implementation
[ "Returns", "unsubscribe_to_email_subscription_url", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L398-L403
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.subscribe_to_optional_target_subscription_url_for
def subscribe_to_optional_target_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_to_optional_target_#{routing_scope(options)}subscription_url", subscription, options) : send("subscribe_to_optional_target_#{routing_...
ruby
def subscribe_to_optional_target_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("subscribe_to_optional_target_#{routing_scope(options)}subscription_url", subscription, options) : send("subscribe_to_optional_target_#{routing_...
[ "def", "subscribe_to_optional_target_subscription_url_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"subscribe_to_optional_target_#{...
Returns subscribe_to_optional_target_subscription_url for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_url for the subscription @todo Needs any other better implementation
[ "Returns", "subscribe_to_optional_target_subscription_url", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L412-L417
train
simukappu/activity_notification
lib/activity_notification/helpers/view_helpers.rb
ActivityNotification.ViewHelpers.unsubscribe_to_optional_target_subscription_url_for
def unsubscribe_to_optional_target_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_to_optional_target_#{routing_scope(options)}subscription_url", subscription, options) : send("unsubscribe_to_optional_target_#{ro...
ruby
def unsubscribe_to_optional_target_subscription_url_for(subscription, params = {}) options = params.dup options.delete(:devise_default_routes) ? send("unsubscribe_to_optional_target_#{routing_scope(options)}subscription_url", subscription, options) : send("unsubscribe_to_optional_target_#{ro...
[ "def", "unsubscribe_to_optional_target_subscription_url_for", "(", "subscription", ",", "params", "=", "{", "}", ")", "options", "=", "params", ".", "dup", "options", ".", "delete", "(", ":devise_default_routes", ")", "?", "send", "(", "\"unsubscribe_to_optional_targe...
Returns unsubscribe_to_optional_target_subscription_url for the target of specified subscription @param [Subscription] subscription Subscription instance @param [Hash] params Request parameters @return [String] subscription_url for the subscription @todo Needs any other better implementation
[ "Returns", "unsubscribe_to_optional_target_subscription_url", "for", "the", "target", "of", "specified", "subscription" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/helpers/view_helpers.rb#L426-L431
train
simukappu/activity_notification
lib/activity_notification/controllers/common_controller.rb
ActivityNotification.CommonController.target_view_path
def target_view_path target_type = @target.to_resources_name view_path = [controller_path, target_type].join('/') lookup_context.exists?(action_name, view_path) ? view_path : [controller_path, DEFAULT_VIEW_DIRECTORY].join('/') end
ruby
def target_view_path target_type = @target.to_resources_name view_path = [controller_path, target_type].join('/') lookup_context.exists?(action_name, view_path) ? view_path : [controller_path, DEFAULT_VIEW_DIRECTORY].join('/') end
[ "def", "target_view_path", "target_type", "=", "@target", ".", "to_resources_name", "view_path", "=", "[", "controller_path", ",", "target_type", "]", ".", "join", "(", "'/'", ")", "lookup_context", ".", "exists?", "(", "action_name", ",", "view_path", ")", "?",...
Returns path of the target view templates. Do not make this method public unless Rendarable module calls controller's target_view_path method to render resources. @api protected
[ "Returns", "path", "of", "the", "target", "view", "templates", ".", "Do", "not", "make", "this", "method", "public", "unless", "Rendarable", "module", "calls", "controller", "s", "target_view_path", "method", "to", "render", "resources", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/controllers/common_controller.rb#L71-L77
train
simukappu/activity_notification
lib/activity_notification/controllers/common_controller.rb
ActivityNotification.CommonController.return_back_or_ajax
def return_back_or_ajax set_index_options respond_to do |format| if request.xhr? load_index if params[:reload].to_s.to_boolean(true) format.js else compatibly_redirect_back(@index_options) and return end end end
ruby
def return_back_or_ajax set_index_options respond_to do |format| if request.xhr? load_index if params[:reload].to_s.to_boolean(true) format.js else compatibly_redirect_back(@index_options) and return end end end
[ "def", "return_back_or_ajax", "set_index_options", "respond_to", "do", "|", "format", "|", "if", "request", ".", "xhr?", "load_index", "if", "params", "[", ":reload", "]", ".", "to_s", ".", "to_boolean", "(", "true", ")", "format", ".", "js", "else", "compat...
Returns JavaScript view for ajax request or redirects to back as default. @api protected @return [Responce] JavaScript view for ajax request or redirects to back as default
[ "Returns", "JavaScript", "view", "for", "ajax", "request", "or", "redirects", "to", "back", "as", "default", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/controllers/common_controller.rb#L88-L98
train
simukappu/activity_notification
lib/activity_notification/controllers/common_controller.rb
ActivityNotification.CommonController.compatibly_redirect_back
def compatibly_redirect_back(request_params = {}) # :only-rails5+: if Rails::VERSION::MAJOR >= 5 redirect_back fallback_location: { action: :index }, **request_params # :only-rails5+: # :except-rails5+: elsif request.referer redirect_to :back, **request_params...
ruby
def compatibly_redirect_back(request_params = {}) # :only-rails5+: if Rails::VERSION::MAJOR >= 5 redirect_back fallback_location: { action: :index }, **request_params # :only-rails5+: # :except-rails5+: elsif request.referer redirect_to :back, **request_params...
[ "def", "compatibly_redirect_back", "(", "request_params", "=", "{", "}", ")", "# :only-rails5+:", "if", "Rails", "::", "VERSION", "::", "MAJOR", ">=", "5", "redirect_back", "fallback_location", ":", "{", "action", ":", ":index", "}", ",", "**", "request_params",...
Redirect to back. @api protected @return [Boolean] True
[ "Redirect", "to", "back", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/controllers/common_controller.rb#L103-L116
train
simukappu/activity_notification
lib/activity_notification/rails/routes.rb
ActionDispatch::Routing.Mapper.notify_to
def notify_to(*resources) options = create_options(:notifications, resources.extract_options!, [:new, :create, :edit, :update]) resources.each do |target| options[:defaults] = { target_type: target.to_s }.merge(options[:devise_defaults]) resources_options = options.select { |key, _| [:with_...
ruby
def notify_to(*resources) options = create_options(:notifications, resources.extract_options!, [:new, :create, :edit, :update]) resources.each do |target| options[:defaults] = { target_type: target.to_s }.merge(options[:devise_defaults]) resources_options = options.select { |key, _| [:with_...
[ "def", "notify_to", "(", "*", "resources", ")", "options", "=", "create_options", "(", ":notifications", ",", "resources", ".", "extract_options!", ",", "[", ":new", ",", ":create", ",", ":edit", ",", ":update", "]", ")", "resources", ".", "each", "do", "|...
Includes notify_to method for routes, which is responsible to generate all necessary routes for notifications of activity_notification. When you have an User model configured as a target (e.g. defined acts_as_target), you can create as follows in your routes: notify_to :users This method creates the needed route...
[ "Includes", "notify_to", "method", "for", "routes", "which", "is", "responsible", "to", "generate", "all", "necessary", "routes", "for", "notifications", "of", "activity_notification", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/rails/routes.rb#L118-L138
train
simukappu/activity_notification
lib/activity_notification/rails/routes.rb
ActionDispatch::Routing.Mapper.subscribed_by
def subscribed_by(*resources) options = create_options(:subscriptions, resources.extract_options!, [:new, :edit, :update]) resources.each do |target| options[:defaults] = { target_type: target.to_s }.merge(options[:devise_defaults]) resources_options = options.select { |key, _| [:with_devis...
ruby
def subscribed_by(*resources) options = create_options(:subscriptions, resources.extract_options!, [:new, :edit, :update]) resources.each do |target| options[:defaults] = { target_type: target.to_s }.merge(options[:devise_defaults]) resources_options = options.select { |key, _| [:with_devis...
[ "def", "subscribed_by", "(", "*", "resources", ")", "options", "=", "create_options", "(", ":subscriptions", ",", "resources", ".", "extract_options!", ",", "[", ":new", ",", ":edit", ",", ":update", "]", ")", "resources", ".", "each", "do", "|", "target", ...
Includes subscribed_by method for routes, which is responsible to generate all necessary routes for subscriptions of activity_notification. When you have an User model configured as a target (e.g. defined acts_as_target), you can create as follows in your routes: subscribed_by :users This method creates the need...
[ "Includes", "subscribed_by", "method", "for", "routes", "which", "is", "responsible", "to", "generate", "all", "necessary", "routes", "for", "subscriptions", "of", "activity_notification", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/rails/routes.rb#L264-L280
train
simukappu/activity_notification
lib/activity_notification/renderable.rb
ActivityNotification.Renderable.text
def text(params = {}) k = key.split('.') k.unshift('notification') if k.first != 'notification' if params.has_key?(:target) k.insert(1, params[:target]) else k.insert(1, target.to_resource_name) end k.push('text') k = k.join('.') attrs = (parameters.symbo...
ruby
def text(params = {}) k = key.split('.') k.unshift('notification') if k.first != 'notification' if params.has_key?(:target) k.insert(1, params[:target]) else k.insert(1, target.to_resource_name) end k.push('text') k = k.join('.') attrs = (parameters.symbo...
[ "def", "text", "(", "params", "=", "{", "}", ")", "k", "=", "key", ".", "split", "(", "'.'", ")", "k", ".", "unshift", "(", "'notification'", ")", "if", "k", ".", "first", "!=", "'notification'", "if", "params", ".", "has_key?", "(", ":target", ")"...
Virtual attribute returning text description of the notification using the notification's key to translate using i18n. @param [Hash] params Parameters for rendering notification text @option params [String] :target Target type name to use as i18n text key @option params [Hash] others Parameters to be referred in i...
[ "Virtual", "attribute", "returning", "text", "description", "of", "the", "notification", "using", "the", "notification", "s", "key", "to", "translate", "using", "i18n", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/renderable.rb#L13-L34
train
simukappu/activity_notification
lib/activity_notification/renderable.rb
ActivityNotification.Renderable.render
def render(context, params = {}) params[:i18n] and return context.render plain: self.text(params) partial = partial_path(*params.values_at(:partial, :partial_root, :target)) layout = layout_path(*params.values_at(:layout, :layout_root)) locals = prepare_locals(params) begin con...
ruby
def render(context, params = {}) params[:i18n] and return context.render plain: self.text(params) partial = partial_path(*params.values_at(:partial, :partial_root, :target)) layout = layout_path(*params.values_at(:layout, :layout_root)) locals = prepare_locals(params) begin con...
[ "def", "render", "(", "context", ",", "params", "=", "{", "}", ")", "params", "[", ":i18n", "]", "and", "return", "context", ".", "render", "plain", ":", "self", ".", "text", "(", "params", ")", "partial", "=", "partial_path", "(", "params", ".", "va...
Renders notification from views. The preferred way of rendering notifications is to provide a template specifying how the rendering should be happening. However, you can choose using _i18n_ based approach when developing an application that supports plenty of languages. If partial view exists that matches the "t...
[ "Renders", "notification", "from", "views", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/renderable.rb#L148-L167
train
simukappu/activity_notification
lib/activity_notification/renderable.rb
ActivityNotification.Renderable.partial_path
def partial_path(path = nil, root = nil, target = nil) controller = ActivityNotification.get_controller if ActivityNotification.respond_to?(:get_controller) root ||= "activity_notification/notifications/#{target}" if target.present? root ||= controller.target_view_path if c...
ruby
def partial_path(path = nil, root = nil, target = nil) controller = ActivityNotification.get_controller if ActivityNotification.respond_to?(:get_controller) root ||= "activity_notification/notifications/#{target}" if target.present? root ||= controller.target_view_path if c...
[ "def", "partial_path", "(", "path", "=", "nil", ",", "root", "=", "nil", ",", "target", "=", "nil", ")", "controller", "=", "ActivityNotification", ".", "get_controller", "if", "ActivityNotification", ".", "respond_to?", "(", ":get_controller", ")", "root", "|...
Returns partial path from options @param [String] path Partial template name @param [String] root Root path of partial template @param [String, Symbol] target Target type name to find template @return [String] Partial template path
[ "Returns", "partial", "path", "from", "options" ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/renderable.rb#L175-L186
train
simukappu/activity_notification
lib/activity_notification/common.rb
ActivityNotification.Common.resolve_value
def resolve_value(thing, *args) case thing when Symbol symbol_method = method(thing) if symbol_method.arity > 0 symbol_method.call(*args) else symbol_method.call end when Proc if thing.arity > 1 thing.call(self, *args) elsif...
ruby
def resolve_value(thing, *args) case thing when Symbol symbol_method = method(thing) if symbol_method.arity > 0 symbol_method.call(*args) else symbol_method.call end when Proc if thing.arity > 1 thing.call(self, *args) elsif...
[ "def", "resolve_value", "(", "thing", ",", "*", "args", ")", "case", "thing", "when", "Symbol", "symbol_method", "=", "method", "(", "thing", ")", "if", "symbol_method", ".", "arity", ">", "0", "symbol_method", ".", "call", "(", "args", ")", "else", "sym...
Used to transform value from metadata to data which belongs model instance. Accepts Symbols, which it will send against this instance, Accepts Procs, which it will execute with this instance. Both Symbols and Procs will be passed arguments of this method. Also accepts Hash of these Symbols or Procs. If any other v...
[ "Used", "to", "transform", "value", "from", "metadata", "to", "data", "which", "belongs", "model", "instance", ".", "Accepts", "Symbols", "which", "it", "will", "send", "against", "this", "instance", "Accepts", "Procs", "which", "it", "will", "execute", "with"...
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/common.rb#L72-L98
train
simukappu/activity_notification
app/controllers/activity_notification/notifications_controller.rb
ActivityNotification.NotificationsController.index
def index set_index_options load_index if params[:reload].to_s.to_boolean(true) respond_to do |format| format.html # index.html.erb format.json { render json: @notifications.to_json(include: [:target, :notifiable, :group]) } end end
ruby
def index set_index_options load_index if params[:reload].to_s.to_boolean(true) respond_to do |format| format.html # index.html.erb format.json { render json: @notifications.to_json(include: [:target, :notifiable, :group]) } end end
[ "def", "index", "set_index_options", "load_index", "if", "params", "[", ":reload", "]", ".", "to_s", ".", "to_boolean", "(", "true", ")", "respond_to", "do", "|", "format", "|", "format", ".", "html", "# index.html.erb", "format", ".", "json", "{", "render",...
Shows notification index of the target. GET /:target_type/:target_id/notifications @overload index(params) @param [Hash] params Request parameter options for notification index @option params [String] :filter (nil) Filter option to load notification index (Nothing as auto, 'opened' or 'unop...
[ "Shows", "notification", "index", "of", "the", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/app/controllers/activity_notification/notifications_controller.rb#L24-L31
train
simukappu/activity_notification
app/controllers/activity_notification/notifications_controller.rb
ActivityNotification.NotificationsController.open
def open with_members = !(params[:with_group_members].to_s.to_boolean(false) || params[:without_grouping].to_s.to_boolean(false)) @notification.open!(with_members: with_members) params[:move].to_s.to_boolean(false) ? move : return_back_or_ajax end
ruby
def open with_members = !(params[:with_group_members].to_s.to_boolean(false) || params[:without_grouping].to_s.to_boolean(false)) @notification.open!(with_members: with_members) params[:move].to_s.to_boolean(false) ? move : return_back_or_ajax end
[ "def", "open", "with_members", "=", "!", "(", "params", "[", ":with_group_members", "]", ".", "to_s", ".", "to_boolean", "(", "false", ")", "||", "params", "[", ":without_grouping", "]", ".", "to_s", ".", "to_boolean", "(", "false", ")", ")", "@notificatio...
Opens a notification. POST /:target_type/:target_id/notifications/:id/open @overload open(params) @param [Hash] params Request parameters @option params [String] :move ('false') Whether redirects to notifiable_path after the notification is opened @option params [String] :filter (n...
[ "Opens", "a", "notification", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/app/controllers/activity_notification/notifications_controller.rb#L91-L97
train
simukappu/activity_notification
app/controllers/activity_notification/notifications_controller.rb
ActivityNotification.NotificationsController.set_index_options
def set_index_options limit = params[:limit].to_i > 0 ? params[:limit].to_i : nil reverse = params[:reverse].present? ? params[:reverse].to_s.to_boolean(false) : nil with_group_members = params[:with_group_members].present? || params[:withou...
ruby
def set_index_options limit = params[:limit].to_i > 0 ? params[:limit].to_i : nil reverse = params[:reverse].present? ? params[:reverse].to_s.to_boolean(false) : nil with_group_members = params[:with_group_members].present? || params[:withou...
[ "def", "set_index_options", "limit", "=", "params", "[", ":limit", "]", ".", "to_i", ">", "0", "?", "params", "[", ":limit", "]", ".", "to_i", ":", "nil", "reverse", "=", "params", "[", ":reverse", "]", ".", "present?", "?", "params", "[", ":reverse", ...
Sets options to load notification index from request parameters. @api protected @return [Hash] options to load notification index
[ "Sets", "options", "to", "load", "notification", "index", "from", "request", "parameters", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/app/controllers/activity_notification/notifications_controller.rb#L132-L141
train
simukappu/activity_notification
lib/activity_notification/models/concerns/target.rb
ActivityNotification.Target.authenticated_with_devise?
def authenticated_with_devise?(current_resource) devise_resource = resolve_value(_notification_devise_resource) unless current_resource.blank? or current_resource.is_a? devise_resource.class raise TypeError, "Different type of current resource #{current_resource.class} "\ "with d...
ruby
def authenticated_with_devise?(current_resource) devise_resource = resolve_value(_notification_devise_resource) unless current_resource.blank? or current_resource.is_a? devise_resource.class raise TypeError, "Different type of current resource #{current_resource.class} "\ "with d...
[ "def", "authenticated_with_devise?", "(", "current_resource", ")", "devise_resource", "=", "resolve_value", "(", "_notification_devise_resource", ")", "unless", "current_resource", ".", "blank?", "or", "current_resource", ".", "is_a?", "devise_resource", ".", "class", "ra...
Returns if current resource signed in with Devise is authenticated for the notification. This method is able to be overriden. @param [Object] current_resource Current resource signed in with Devise @return [Boolean] If current resource signed in with Devise is authenticated for the notification
[ "Returns", "if", "current", "resource", "signed", "in", "with", "Devise", "is", "authenticated", "for", "the", "notification", ".", "This", "method", "is", "able", "to", "be", "overriden", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/target.rb#L194-L203
train
simukappu/activity_notification
lib/activity_notification/models/concerns/target.rb
ActivityNotification.Target.send_batch_notification_email
def send_batch_notification_email(notifications, options = {}) return if notifications.blank? if notifications.map{ |n| n.target }.uniq == [self] Notification.send_batch_notification_email(self, notifications, options) end end
ruby
def send_batch_notification_email(notifications, options = {}) return if notifications.blank? if notifications.map{ |n| n.target }.uniq == [self] Notification.send_batch_notification_email(self, notifications, options) end end
[ "def", "send_batch_notification_email", "(", "notifications", ",", "options", "=", "{", "}", ")", "return", "if", "notifications", ".", "blank?", "if", "notifications", ".", "map", "{", "|", "n", "|", "n", ".", "target", "}", ".", "uniq", "==", "[", "sel...
Sends batch notification email to the target. @param [Array<Notification>] notifications Target notifications to send batch notification email @param [Hash] options Options for notification email @option options [Boolean] :send_later (false) If it sends notification email async...
[ "Sends", "batch", "notification", "email", "to", "the", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/target.rb#L462-L467
train
simukappu/activity_notification
lib/activity_notification/models/concerns/target.rb
ActivityNotification.Target.subscribes_to_notification?
def subscribes_to_notification?(key, subscribe_as_default = ActivityNotification.config.subscribe_as_default) !subscription_allowed?(key) || _subscribes_to_notification?(key, subscribe_as_default) end
ruby
def subscribes_to_notification?(key, subscribe_as_default = ActivityNotification.config.subscribe_as_default) !subscription_allowed?(key) || _subscribes_to_notification?(key, subscribe_as_default) end
[ "def", "subscribes_to_notification?", "(", "key", ",", "subscribe_as_default", "=", "ActivityNotification", ".", "config", ".", "subscribe_as_default", ")", "!", "subscription_allowed?", "(", "key", ")", "||", "_subscribes_to_notification?", "(", "key", ",", "subscribe_...
Returns if the target subscribes to the notification. It also returns true when the subscription management is not allowed for the target. @param [String] key Key of the notification @param [Boolean] subscribe_as_default Default subscription value to use when the subscription record does not confi...
[ "Returns", "if", "the", "target", "subscribes", "to", "the", "notification", ".", "It", "also", "returns", "true", "when", "the", "subscription", "management", "is", "not", "allowed", "for", "the", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/target.rb#L475-L477
train
simukappu/activity_notification
lib/activity_notification/models/concerns/target.rb
ActivityNotification.Target.subscribes_to_notification_email?
def subscribes_to_notification_email?(key, subscribe_as_default = ActivityNotification.config.subscribe_as_default) !subscription_allowed?(key) || _subscribes_to_notification_email?(key, subscribe_as_default) end
ruby
def subscribes_to_notification_email?(key, subscribe_as_default = ActivityNotification.config.subscribe_as_default) !subscription_allowed?(key) || _subscribes_to_notification_email?(key, subscribe_as_default) end
[ "def", "subscribes_to_notification_email?", "(", "key", ",", "subscribe_as_default", "=", "ActivityNotification", ".", "config", ".", "subscribe_as_default", ")", "!", "subscription_allowed?", "(", "key", ")", "||", "_subscribes_to_notification_email?", "(", "key", ",", ...
Returns if the target subscribes to the notification email. It also returns true when the subscription management is not allowed for the target. @param [String] key Key of the notification @param [Boolean] subscribe_as_default Default subscription value to use when the subscription record does not...
[ "Returns", "if", "the", "target", "subscribes", "to", "the", "notification", "email", ".", "It", "also", "returns", "true", "when", "the", "subscription", "management", "is", "not", "allowed", "for", "the", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/target.rb#L485-L487
train
simukappu/activity_notification
lib/activity_notification/models/concerns/target.rb
ActivityNotification.Target.subscribes_to_optional_target?
def subscribes_to_optional_target?(key, optional_target_name, subscribe_as_default = ActivityNotification.config.subscribe_as_default) !subscription_allowed?(key) || _subscribes_to_optional_target?(key, optional_target_name, subscribe_as_default) end
ruby
def subscribes_to_optional_target?(key, optional_target_name, subscribe_as_default = ActivityNotification.config.subscribe_as_default) !subscription_allowed?(key) || _subscribes_to_optional_target?(key, optional_target_name, subscribe_as_default) end
[ "def", "subscribes_to_optional_target?", "(", "key", ",", "optional_target_name", ",", "subscribe_as_default", "=", "ActivityNotification", ".", "config", ".", "subscribe_as_default", ")", "!", "subscription_allowed?", "(", "key", ")", "||", "_subscribes_to_optional_target?...
Returns if the target subscribes to the specified optional target. It also returns true when the subscription management is not allowed for the target. @param [String] key Key of the notification @param [String, Symbol] optional_target_name Class name of the optional target implementation (...
[ "Returns", "if", "the", "target", "subscribes", "to", "the", "specified", "optional", "target", ".", "It", "also", "returns", "true", "when", "the", "subscription", "management", "is", "not", "allowed", "for", "the", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/target.rb#L497-L499
train
simukappu/activity_notification
lib/activity_notification/models/concerns/target.rb
ActivityNotification.Target._opened_notification_index
def _opened_notification_index(options = {}) limit = options[:limit] || ActivityNotification.config.opened_index_limit reverse = options[:reverse] || false with_group_members = options[:with_group_members] || false notifications.opened_index(limit, reverse, with_g...
ruby
def _opened_notification_index(options = {}) limit = options[:limit] || ActivityNotification.config.opened_index_limit reverse = options[:reverse] || false with_group_members = options[:with_group_members] || false notifications.opened_index(limit, reverse, with_g...
[ "def", "_opened_notification_index", "(", "options", "=", "{", "}", ")", "limit", "=", "options", "[", ":limit", "]", "||", "ActivityNotification", ".", "config", ".", "opened_index_limit", "reverse", "=", "options", "[", ":reverse", "]", "||", "false", "with_...
Gets opened notification index of the target as ActiveRecord. @param [Hash] options Options for notification index @option options [Integer] :limit (nil) Limit to query for notifications @option options [Boolean] :reverse (false) If notification index will be ordered as earli...
[ "Gets", "opened", "notification", "index", "of", "the", "target", "as", "ActiveRecord", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/target.rb#L537-L542
train
simukappu/activity_notification
lib/activity_notification/apis/subscription_api.rb
ActivityNotification.SubscriptionApi.subscribe
def subscribe(options = {}) subscribed_at = options[:subscribed_at] || Time.current with_email_subscription = options.has_key?(:with_email_subscription) ? options[:with_email_subscription] : true with_optional_targets = options.has_key?(:with_optional_targets) ? options[:with_optional_targets] : tru...
ruby
def subscribe(options = {}) subscribed_at = options[:subscribed_at] || Time.current with_email_subscription = options.has_key?(:with_email_subscription) ? options[:with_email_subscription] : true with_optional_targets = options.has_key?(:with_optional_targets) ? options[:with_optional_targets] : tru...
[ "def", "subscribe", "(", "options", "=", "{", "}", ")", "subscribed_at", "=", "options", "[", ":subscribed_at", "]", "||", "Time", ".", "current", "with_email_subscription", "=", "options", ".", "has_key?", "(", ":with_email_subscription", ")", "?", "options", ...
Subscribes to the notification and notification email. @param [Hash] options Options for subscribing to the notification @option options [DateTime] :subscribed_at (Time.current) Time to set to subscribed_at and subscribed_to_email_at of the subscription record @option options [Boolean] :with_email_subscr...
[ "Subscribes", "to", "the", "notification", "and", "notification", "email", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/subscription_api.rb#L88-L102
train
simukappu/activity_notification
lib/activity_notification/apis/subscription_api.rb
ActivityNotification.SubscriptionApi.unsubscribe
def unsubscribe(options = {}) unsubscribed_at = options[:unsubscribed_at] || Time.current new_attributes = { subscribing: false, unsubscribed_at: unsubscribed_at, subscribing_to_email: false, unsubscribed_to_email_at: unsubscribed_at, optio...
ruby
def unsubscribe(options = {}) unsubscribed_at = options[:unsubscribed_at] || Time.current new_attributes = { subscribing: false, unsubscribed_at: unsubscribed_at, subscribing_to_email: false, unsubscribed_to_email_at: unsubscribed_at, optio...
[ "def", "unsubscribe", "(", "options", "=", "{", "}", ")", "unsubscribed_at", "=", "options", "[", ":unsubscribed_at", "]", "||", "Time", ".", "current", "new_attributes", "=", "{", "subscribing", ":", "false", ",", "unsubscribed_at", ":", "unsubscribed_at", ",...
Unsubscribes to the notification and notification email. @param [Hash] options Options for unsubscribing to the notification @option options [DateTime] :unsubscribed_at (Time.current) Time to set to unsubscribed_at and unsubscribed_to_email_at of the subscription record @return [Boolean] If successfully updated sub...
[ "Unsubscribes", "to", "the", "notification", "and", "notification", "email", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/subscription_api.rb#L109-L120
train
simukappu/activity_notification
lib/activity_notification/apis/subscription_api.rb
ActivityNotification.SubscriptionApi.subscribe_to_email
def subscribe_to_email(options = {}) subscribed_to_email_at = options[:subscribed_to_email_at] || Time.current update(subscribing_to_email: true, subscribed_to_email_at: subscribed_to_email_at) end
ruby
def subscribe_to_email(options = {}) subscribed_to_email_at = options[:subscribed_to_email_at] || Time.current update(subscribing_to_email: true, subscribed_to_email_at: subscribed_to_email_at) end
[ "def", "subscribe_to_email", "(", "options", "=", "{", "}", ")", "subscribed_to_email_at", "=", "options", "[", ":subscribed_to_email_at", "]", "||", "Time", ".", "current", "update", "(", "subscribing_to_email", ":", "true", ",", "subscribed_to_email_at", ":", "s...
Subscribes to the notification email. @param [Hash] options Options for subscribing to the notification email @option options [DateTime] :subscribed_to_email_at (Time.current) Time to set to subscribed_to_email_at of the subscription record @return [Boolean] If successfully updated subscription instance
[ "Subscribes", "to", "the", "notification", "email", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/subscription_api.rb#L127-L130
train
simukappu/activity_notification
lib/activity_notification/apis/subscription_api.rb
ActivityNotification.SubscriptionApi.unsubscribe_to_email
def unsubscribe_to_email(options = {}) unsubscribed_to_email_at = options[:unsubscribed_to_email_at] || Time.current update(subscribing_to_email: false, unsubscribed_to_email_at: unsubscribed_to_email_at) end
ruby
def unsubscribe_to_email(options = {}) unsubscribed_to_email_at = options[:unsubscribed_to_email_at] || Time.current update(subscribing_to_email: false, unsubscribed_to_email_at: unsubscribed_to_email_at) end
[ "def", "unsubscribe_to_email", "(", "options", "=", "{", "}", ")", "unsubscribed_to_email_at", "=", "options", "[", ":unsubscribed_to_email_at", "]", "||", "Time", ".", "current", "update", "(", "subscribing_to_email", ":", "false", ",", "unsubscribed_to_email_at", ...
Unsubscribes to the notification email. @param [Hash] options Options for unsubscribing the notification email @option options [DateTime] :subscribed_to_email_at (Time.current) Time to set to subscribed_to_email_at of the subscription record @return [Boolean] If successfully updated subscription instance
[ "Unsubscribes", "to", "the", "notification", "email", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/subscription_api.rb#L137-L140
train
simukappu/activity_notification
lib/activity_notification/apis/subscription_api.rb
ActivityNotification.SubscriptionApi.subscribing_to_optional_target?
def subscribing_to_optional_target?(optional_target_name, subscribe_as_default = ActivityNotification.config.subscribe_as_default) optional_target_key = Subscription.to_optional_target_key(optional_target_name) subscribe_as_default ? !optional_targets.has_key?(optional_target_key) || optional_target...
ruby
def subscribing_to_optional_target?(optional_target_name, subscribe_as_default = ActivityNotification.config.subscribe_as_default) optional_target_key = Subscription.to_optional_target_key(optional_target_name) subscribe_as_default ? !optional_targets.has_key?(optional_target_key) || optional_target...
[ "def", "subscribing_to_optional_target?", "(", "optional_target_name", ",", "subscribe_as_default", "=", "ActivityNotification", ".", "config", ".", "subscribe_as_default", ")", "optional_target_key", "=", "Subscription", ".", "to_optional_target_key", "(", "optional_target_nam...
Returns if the target subscribes to the specified optional target. @param [Symbol] optional_target_name Symbol class name of the optional target implementation (e.g. :amazon_sns, :slack) @param [Boolean] subscribe_as_default Default subscription value to use when the subscription record does not configured @return...
[ "Returns", "if", "the", "target", "subscribes", "to", "the", "specified", "optional", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/subscription_api.rb#L147-L152
train
simukappu/activity_notification
lib/activity_notification/apis/subscription_api.rb
ActivityNotification.SubscriptionApi.subscribe_to_optional_target
def subscribe_to_optional_target(optional_target_name, options = {}) subscribed_at = options[:subscribed_at] || Time.current update(optional_targets: optional_targets.merge( Subscription.to_optional_target_key(optional_target_name) => true, Subscription.to_optional_target_subscribed_at_key(o...
ruby
def subscribe_to_optional_target(optional_target_name, options = {}) subscribed_at = options[:subscribed_at] || Time.current update(optional_targets: optional_targets.merge( Subscription.to_optional_target_key(optional_target_name) => true, Subscription.to_optional_target_subscribed_at_key(o...
[ "def", "subscribe_to_optional_target", "(", "optional_target_name", ",", "options", "=", "{", "}", ")", "subscribed_at", "=", "options", "[", ":subscribed_at", "]", "||", "Time", ".", "current", "update", "(", "optional_targets", ":", "optional_targets", ".", "mer...
Subscribes to the specified optional target. @param [String, Symbol] optional_target_name Symbol class name of the optional target implementation (e.g. :amazon_sns, :slack) @param [Hash] options Options for unsubscribing to the specified optional target @option options [DateTime] :subscribe...
[ "Subscribes", "to", "the", "specified", "optional", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/subscription_api.rb#L160-L166
train
simukappu/activity_notification
lib/activity_notification/apis/subscription_api.rb
ActivityNotification.SubscriptionApi.unsubscribe_to_optional_target
def unsubscribe_to_optional_target(optional_target_name, options = {}) unsubscribed_at = options[:unsubscribed_at] || Time.current update(optional_targets: optional_targets.merge( Subscription.to_optional_target_key(optional_target_name) => false, Subscription.to_optional_target_unsubscribed...
ruby
def unsubscribe_to_optional_target(optional_target_name, options = {}) unsubscribed_at = options[:unsubscribed_at] || Time.current update(optional_targets: optional_targets.merge( Subscription.to_optional_target_key(optional_target_name) => false, Subscription.to_optional_target_unsubscribed...
[ "def", "unsubscribe_to_optional_target", "(", "optional_target_name", ",", "options", "=", "{", "}", ")", "unsubscribed_at", "=", "options", "[", ":unsubscribed_at", "]", "||", "Time", ".", "current", "update", "(", "optional_targets", ":", "optional_targets", ".", ...
Unsubscribes to the specified optional target. @param [String, Symbol] optional_target_name Class name of the optional target implementation (e.g. :amazon_sns, :slack) @param [Hash] options Options for unsubscribing to the specified optional target @option options [DateTime] :unsubscribed_at ...
[ "Unsubscribes", "to", "the", "specified", "optional", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/subscription_api.rb#L174-L180
train
simukappu/activity_notification
lib/activity_notification/apis/subscription_api.rb
ActivityNotification.SubscriptionApi.optional_target_names
def optional_target_names optional_targets.keys.select { |key| key.to_s.start_with?("subscribing_to_") }.map { |key| key.slice(15..-1) } end
ruby
def optional_target_names optional_targets.keys.select { |key| key.to_s.start_with?("subscribing_to_") }.map { |key| key.slice(15..-1) } end
[ "def", "optional_target_names", "optional_targets", ".", "keys", ".", "select", "{", "|", "key", "|", "key", ".", "to_s", ".", "start_with?", "(", "\"subscribing_to_\"", ")", "}", ".", "map", "{", "|", "key", "|", "key", ".", "slice", "(", "15", "..", ...
Returns optional_target names of the subscription from optional_targets field. @return [Array<Symbol>] Array of optional target names
[ "Returns", "optional_target", "names", "of", "the", "subscription", "from", "optional_targets", "field", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/apis/subscription_api.rb#L184-L186
train
simukappu/activity_notification
lib/activity_notification/models/concerns/notifiable.rb
ActivityNotification.Notifiable.notification_targets
def notification_targets(target_type, options = {}) target_typed_method_name = "notification_#{cast_to_resources_name(target_type)}" resolved_parameter = resolve_parameter( target_typed_method_name, _notification_targets[cast_to_resources_sym(target_type)], nil, options) ...
ruby
def notification_targets(target_type, options = {}) target_typed_method_name = "notification_#{cast_to_resources_name(target_type)}" resolved_parameter = resolve_parameter( target_typed_method_name, _notification_targets[cast_to_resources_sym(target_type)], nil, options) ...
[ "def", "notification_targets", "(", "target_type", ",", "options", "=", "{", "}", ")", "target_typed_method_name", "=", "\"notification_#{cast_to_resources_name(target_type)}\"", "resolved_parameter", "=", "resolve_parameter", "(", "target_typed_method_name", ",", "_notificatio...
Returns notification targets from configured field or overriden method. This method is able to be overriden. @param [String] target_type Target type to notify @param [Hash] options Options for notifications @option options [String] :key (notifiable.default_notification_key) Ke...
[ "Returns", "notification", "targets", "from", "configured", "field", "or", "overriden", "method", ".", "This", "method", "is", "able", "to", "be", "overriden", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/notifiable.rb#L71-L83
train
simukappu/activity_notification
lib/activity_notification/models/concerns/notifiable.rb
ActivityNotification.Notifiable.notification_email_allowed?
def notification_email_allowed?(target, key = nil) resolve_parameter( "notification_email_allowed_for_#{cast_to_resources_name(target.class)}?", _notification_email_allowed[cast_to_resources_sym(target.class)], ActivityNotification.config.email_enabled, target, key) end
ruby
def notification_email_allowed?(target, key = nil) resolve_parameter( "notification_email_allowed_for_#{cast_to_resources_name(target.class)}?", _notification_email_allowed[cast_to_resources_sym(target.class)], ActivityNotification.config.email_enabled, target, key) end
[ "def", "notification_email_allowed?", "(", "target", ",", "key", "=", "nil", ")", "resolve_parameter", "(", "\"notification_email_allowed_for_#{cast_to_resources_name(target.class)}?\"", ",", "_notification_email_allowed", "[", "cast_to_resources_sym", "(", "target", ".", "clas...
Returns if sending notification email is allowed for the notifiable from configured field or overriden method. This method is able to be overriden. @param [Object] target Target instance to notify @param [String] key Key of the notification @return [Boolean] If sending notification email is allowed for the notifia...
[ "Returns", "if", "sending", "notification", "email", "is", "allowed", "for", "the", "notifiable", "from", "configured", "field", "or", "overriden", "method", ".", "This", "method", "is", "able", "to", "be", "overriden", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/notifiable.rb#L147-L153
train
simukappu/activity_notification
lib/activity_notification/models/concerns/notifiable.rb
ActivityNotification.Notifiable.notifiable_path
def notifiable_path(target_type, key = nil) resolved_parameter = resolve_parameter( "notifiable_path_for_#{cast_to_resources_name(target_type)}", _notifiable_path[cast_to_resources_sym(target_type)], nil, key) unless resolved_parameter begin resolved_paramet...
ruby
def notifiable_path(target_type, key = nil) resolved_parameter = resolve_parameter( "notifiable_path_for_#{cast_to_resources_name(target_type)}", _notifiable_path[cast_to_resources_sym(target_type)], nil, key) unless resolved_parameter begin resolved_paramet...
[ "def", "notifiable_path", "(", "target_type", ",", "key", "=", "nil", ")", "resolved_parameter", "=", "resolve_parameter", "(", "\"notifiable_path_for_#{cast_to_resources_name(target_type)}\"", ",", "_notifiable_path", "[", "cast_to_resources_sym", "(", "target_type", ")", ...
Returns notifiable_path to move after opening notification from configured field or overriden method. This method is able to be overriden. @param [String] target_type Target type to notify @param [String] key Key of the notification @return [String] Notifiable path URL to move after opening notification
[ "Returns", "notifiable_path", "to", "move", "after", "opening", "notification", "from", "configured", "field", "or", "overriden", "method", ".", "This", "method", "is", "able", "to", "be", "overriden", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/notifiable.rb#L161-L177
train
simukappu/activity_notification
lib/activity_notification/models/concerns/notifiable.rb
ActivityNotification.Notifiable.printable_notifiable_name
def printable_notifiable_name(target, key = nil) resolve_parameter( "printable_notifiable_name_for_#{cast_to_resources_name(target.class)}?", _printable_notifiable_name[cast_to_resources_sym(target.class)], printable_name, target, key) end
ruby
def printable_notifiable_name(target, key = nil) resolve_parameter( "printable_notifiable_name_for_#{cast_to_resources_name(target.class)}?", _printable_notifiable_name[cast_to_resources_sym(target.class)], printable_name, target, key) end
[ "def", "printable_notifiable_name", "(", "target", ",", "key", "=", "nil", ")", "resolve_parameter", "(", "\"printable_notifiable_name_for_#{cast_to_resources_name(target.class)}?\"", ",", "_printable_notifiable_name", "[", "cast_to_resources_sym", "(", "target", ".", "class", ...
Returns printable notifiable model name to show in view or email. @return [String] Printable notifiable model name
[ "Returns", "printable", "notifiable", "model", "name", "to", "show", "in", "view", "or", "email", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/notifiable.rb#L181-L187
train
simukappu/activity_notification
lib/activity_notification/models/concerns/notifiable.rb
ActivityNotification.Notifiable.optional_target_names
def optional_target_names(target_type, key = nil) optional_targets(target_type, key).map { |optional_target| optional_target.to_optional_target_name } end
ruby
def optional_target_names(target_type, key = nil) optional_targets(target_type, key).map { |optional_target| optional_target.to_optional_target_name } end
[ "def", "optional_target_names", "(", "target_type", ",", "key", "=", "nil", ")", "optional_targets", "(", "target_type", ",", "key", ")", ".", "map", "{", "|", "optional_target", "|", "optional_target", ".", "to_optional_target_name", "}", "end" ]
Returns optional_target names of the notification from configured field or overriden method. This method is able to be overriden. @param [String] target_type Target type to notify @param [String] key Key of the notification @return [Array<Symbol>] Array of optional target names
[ "Returns", "optional_target", "names", "of", "the", "notification", "from", "configured", "field", "or", "overriden", "method", ".", "This", "method", "is", "able", "to", "be", "overriden", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/notifiable.rb#L209-L211
train
simukappu/activity_notification
lib/activity_notification/models/concerns/notifiable.rb
ActivityNotification.Notifiable.generated_notifications_as_notifiable_for
def generated_notifications_as_notifiable_for(target_type = nil) target_type.nil? ? generated_notifications_as_notifiable.all : generated_notifications_as_notifiable.filtered_by_target_type(target_type.to_s.to_model_name) end
ruby
def generated_notifications_as_notifiable_for(target_type = nil) target_type.nil? ? generated_notifications_as_notifiable.all : generated_notifications_as_notifiable.filtered_by_target_type(target_type.to_s.to_model_name) end
[ "def", "generated_notifications_as_notifiable_for", "(", "target_type", "=", "nil", ")", "target_type", ".", "nil?", "?", "generated_notifications_as_notifiable", ".", "all", ":", "generated_notifications_as_notifiable", ".", "filtered_by_target_type", "(", "target_type", "."...
Gets generated notifications for specified target type. @api private @param [String] target_type Target type of generated notifications
[ "Gets", "generated", "notifications", "for", "specified", "target", "type", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/notifiable.rb#L405-L409
train
simukappu/activity_notification
lib/activity_notification/models/concerns/notifiable.rb
ActivityNotification.Notifiable.destroy_generated_notifications_with_dependency
def destroy_generated_notifications_with_dependency(dependent = :delete_all, target_type = nil, remove_from_group = false) remove_generated_notifications_from_group(target_type) if remove_from_group generated_notifications = generated_notifications_as_notifiable_for(target_type) case dependent ...
ruby
def destroy_generated_notifications_with_dependency(dependent = :delete_all, target_type = nil, remove_from_group = false) remove_generated_notifications_from_group(target_type) if remove_from_group generated_notifications = generated_notifications_as_notifiable_for(target_type) case dependent ...
[ "def", "destroy_generated_notifications_with_dependency", "(", "dependent", "=", ":delete_all", ",", "target_type", "=", "nil", ",", "remove_from_group", "=", "false", ")", "remove_generated_notifications_from_group", "(", "target_type", ")", "if", "remove_from_group", "gen...
Destroies generated notifications for specified target type with dependency. This method is intended to be called before destroy this notifiable as dependent configuration. @api private @param [Symbol] dependent Has_many dependency, [:delete_all, :destroy, :restrict_with_error, :restrict_with_exception] are...
[ "Destroies", "generated", "notifications", "for", "specified", "target", "type", "with", "dependency", ".", "This", "method", "is", "intended", "to", "be", "called", "before", "destroy", "this", "notifiable", "as", "dependent", "configuration", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/notifiable.rb#L417-L442
train
simukappu/activity_notification
app/controllers/activity_notification/subscriptions_controller.rb
ActivityNotification.SubscriptionsController.index
def index set_index_options load_index if params[:reload].to_s.to_boolean(true) respond_to do |format| format.html # index.html.erb format.json { render json: { subscriptions: @subscriptions, unconfigured_notification_keys: @notification_keys } } end end
ruby
def index set_index_options load_index if params[:reload].to_s.to_boolean(true) respond_to do |format| format.html # index.html.erb format.json { render json: { subscriptions: @subscriptions, unconfigured_notification_keys: @notification_keys } } end end
[ "def", "index", "set_index_options", "load_index", "if", "params", "[", ":reload", "]", ".", "to_s", ".", "to_boolean", "(", "true", ")", "respond_to", "do", "|", "format", "|", "format", ".", "html", "# index.html.erb", "format", ".", "json", "{", "render",...
Shows subscription index of the target. GET /:target_type/:target_id/subscriptions @overload index(params) @param [Hash] params Request parameter options for subscription index @option params [String] :filter (nil) Filter option to load subscription index (Nothing as all, 'configured' or 'unconfig...
[ "Shows", "subscription", "index", "of", "the", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/app/controllers/activity_notification/subscriptions_controller.rb#L19-L26
train
simukappu/activity_notification
app/controllers/activity_notification/subscriptions_controller.rb
ActivityNotification.SubscriptionsController.subscribe
def subscribe @subscription.subscribe(with_email_subscription: params[:with_email_subscription].to_s.to_boolean(true), with_optional_targets: params[:with_optional_targets].to_s.to_boolean(true)) return_back_or_ajax end
ruby
def subscribe @subscription.subscribe(with_email_subscription: params[:with_email_subscription].to_s.to_boolean(true), with_optional_targets: params[:with_optional_targets].to_s.to_boolean(true)) return_back_or_ajax end
[ "def", "subscribe", "@subscription", ".", "subscribe", "(", "with_email_subscription", ":", "params", "[", ":with_email_subscription", "]", ".", "to_s", ".", "to_boolean", "(", "true", ")", ",", "with_optional_targets", ":", "params", "[", ":with_optional_targets", ...
Subscribes to the notification. POST /:target_type/:target_id/subscriptions/:id/subscribe @overload open(params) @param [Hash] params Request parameters @option params [String] :with_email_subscription ('true') If the subscriber also subscribes notification email @option params [String] :with_optional_targ...
[ "Subscribes", "to", "the", "notification", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/app/controllers/activity_notification/subscriptions_controller.rb#L86-L90
train
simukappu/activity_notification
app/controllers/activity_notification/subscriptions_controller.rb
ActivityNotification.SubscriptionsController.set_index_options
def set_index_options limit = params[:limit].to_i > 0 ? params[:limit].to_i : nil reverse = params[:reverse].present? ? params[:reverse].to_s.to_boolean(false) : nil @index_options = params.permit(:filter, :filtered_by_key, :routing_scope, :devise_defau...
ruby
def set_index_options limit = params[:limit].to_i > 0 ? params[:limit].to_i : nil reverse = params[:reverse].present? ? params[:reverse].to_s.to_boolean(false) : nil @index_options = params.permit(:filter, :filtered_by_key, :routing_scope, :devise_defau...
[ "def", "set_index_options", "limit", "=", "params", "[", ":limit", "]", ".", "to_i", ">", "0", "?", "params", "[", ":limit", "]", ".", "to_i", ":", "nil", "reverse", "=", "params", "[", ":reverse", "]", ".", "present?", "?", "params", "[", ":reverse", ...
Sets options to load subscription index from request parameters. @api protected @return [Hash] options to load subscription index
[ "Sets", "options", "to", "load", "subscription", "index", "from", "request", "parameters", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/app/controllers/activity_notification/subscriptions_controller.rb#L190-L196
train
simukappu/activity_notification
app/controllers/activity_notification/subscriptions_controller.rb
ActivityNotification.SubscriptionsController.load_index
def load_index case @index_options[:filter] when :configured, 'configured' @subscriptions = @target.subscription_index(@index_options.merge(with_target: true)) @notification_keys = nil when :unconfigured, 'unconfigured' @subscriptions = nil @notification_k...
ruby
def load_index case @index_options[:filter] when :configured, 'configured' @subscriptions = @target.subscription_index(@index_options.merge(with_target: true)) @notification_keys = nil when :unconfigured, 'unconfigured' @subscriptions = nil @notification_k...
[ "def", "load_index", "case", "@index_options", "[", ":filter", "]", "when", ":configured", ",", "'configured'", "@subscriptions", "=", "@target", ".", "subscription_index", "(", "@index_options", ".", "merge", "(", "with_target", ":", "true", ")", ")", "@notificat...
Loads subscription index with request parameters. @api protected @return [Array] Array of subscription index
[ "Loads", "subscription", "index", "with", "request", "parameters", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/app/controllers/activity_notification/subscriptions_controller.rb#L201-L213
train
simukappu/activity_notification
lib/activity_notification/models/concerns/subscriber.rb
ActivityNotification.Subscriber.find_or_create_subscription
def find_or_create_subscription(key, subscription_params = {}) subscription = find_subscription(key) subscription || create_subscription(subscription_params.merge(key: key)) end
ruby
def find_or_create_subscription(key, subscription_params = {}) subscription = find_subscription(key) subscription || create_subscription(subscription_params.merge(key: key)) end
[ "def", "find_or_create_subscription", "(", "key", ",", "subscription_params", "=", "{", "}", ")", "subscription", "=", "find_subscription", "(", "key", ")", "subscription", "||", "create_subscription", "(", "subscription_params", ".", "merge", "(", "key", ":", "ke...
Gets subscription of the target and notification key. @param [Hash] key Key of the notification for subscription @param [Hash] subscription_params Parameters to create subscription record @return [Subscription] Found or created subscription instance
[ "Gets", "subscription", "of", "the", "target", "and", "notification", "key", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/subscriber.rb#L41-L44
train
simukappu/activity_notification
lib/activity_notification/models/concerns/subscriber.rb
ActivityNotification.Subscriber.create_subscription
def create_subscription(subscription_params = {}) created_at = Time.current if subscription_params[:subscribing] == false && subscription_params[:subscribing_to_email].nil? subscription_params[:subscribing_to_email] = subscription_params[:subscribing] end subscription = subscriptions.ne...
ruby
def create_subscription(subscription_params = {}) created_at = Time.current if subscription_params[:subscribing] == false && subscription_params[:subscribing_to_email].nil? subscription_params[:subscribing_to_email] = subscription_params[:subscribing] end subscription = subscriptions.ne...
[ "def", "create_subscription", "(", "subscription_params", "=", "{", "}", ")", "created_at", "=", "Time", ".", "current", "if", "subscription_params", "[", ":subscribing", "]", "==", "false", "&&", "subscription_params", "[", ":subscribing_to_email", "]", ".", "nil...
Creates new subscription of the target. @param [Hash] subscription_params Parameters to create subscription record @return [Subscription] Created subscription instance
[ "Creates", "new", "subscription", "of", "the", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/subscriber.rb#L50-L77
train
simukappu/activity_notification
lib/activity_notification/models/concerns/subscriber.rb
ActivityNotification.Subscriber.subscription_index
def subscription_index(options = {}) target_index = subscriptions.filtered_by_options(options) target_index = options[:reverse] ? target_index.earliest_order : target_index.latest_order target_index = target_index.with_target if options[:with_target] options[:limit].present? ? target_index.limit...
ruby
def subscription_index(options = {}) target_index = subscriptions.filtered_by_options(options) target_index = options[:reverse] ? target_index.earliest_order : target_index.latest_order target_index = target_index.with_target if options[:with_target] options[:limit].present? ? target_index.limit...
[ "def", "subscription_index", "(", "options", "=", "{", "}", ")", "target_index", "=", "subscriptions", ".", "filtered_by_options", "(", "options", ")", "target_index", "=", "options", "[", ":reverse", "]", "?", "target_index", ".", "earliest_order", ":", "target...
Gets configured subscription index of the target. @example Get configured subscription index of the @user @subscriptions = @user.subscription_index @param [Hash] options Options for subscription index @option options [Integer] :limit (nil) Limit to query for subscriptions @option options ...
[ "Gets", "configured", "subscription", "index", "of", "the", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/subscriber.rb#L91-L96
train
simukappu/activity_notification
lib/activity_notification/models/concerns/subscriber.rb
ActivityNotification.Subscriber.notification_keys
def notification_keys(options = {}) subscription_keys = subscriptions.uniq_keys target_notifications = notifications.filtered_by_options(options.select { |k, _| [:filtered_by_key, :custom_filter].include?(k) }) target_notifications = options[:reverse] ? target_notifications.earliest_order : target_...
ruby
def notification_keys(options = {}) subscription_keys = subscriptions.uniq_keys target_notifications = notifications.filtered_by_options(options.select { |k, _| [:filtered_by_key, :custom_filter].include?(k) }) target_notifications = options[:reverse] ? target_notifications.earliest_order : target_...
[ "def", "notification_keys", "(", "options", "=", "{", "}", ")", "subscription_keys", "=", "subscriptions", ".", "uniq_keys", "target_notifications", "=", "notifications", ".", "filtered_by_options", "(", "options", ".", "select", "{", "|", "k", ",", "_", "|", ...
Gets received notification keys of the target. @example Get unconfigured notification keys of the @user @notification_keys = @user.notification_keys(filter: :unconfigured) @param [Hash] options Options for unconfigured notification keys @option options [Integer] :limit (nil) Limit to qu...
[ "Gets", "received", "notification", "keys", "of", "the", "target", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/subscriber.rb#L110-L126
train
simukappu/activity_notification
lib/activity_notification/models/concerns/subscriber.rb
ActivityNotification.Subscriber.evaluate_subscription
def evaluate_subscription(record, field, default, *args) default ? record.blank? || record.send(field, *args) : record.present? && record.send(field, *args) end
ruby
def evaluate_subscription(record, field, default, *args) default ? record.blank? || record.send(field, *args) : record.present? && record.send(field, *args) end
[ "def", "evaluate_subscription", "(", "record", ",", "field", ",", "default", ",", "*", "args", ")", "default", "?", "record", ".", "blank?", "||", "record", ".", "send", "(", "field", ",", "args", ")", ":", "record", ".", "present?", "&&", "record", "....
Returns if the target subscribes. @api private @param [Boolean] record Subscription record @param [Symbol] field Evaluating subscription field or method of the record @param [Boolean] default Default subscription value to use when the subscription record does not configured @param [Array] args Arguments o...
[ "Returns", "if", "the", "target", "subscribes", "." ]
7f0f0ea8db1e69d7806f5b0685e226452714847a
https://github.com/simukappu/activity_notification/blob/7f0f0ea8db1e69d7806f5b0685e226452714847a/lib/activity_notification/models/concerns/subscriber.rb#L175-L177
train
puppetlabs/puppet-resource_api
lib/puppet/resource_api/glue.rb
Puppet::ResourceApi.ResourceShim.to_hierayaml
def to_hierayaml attributes = Hash[filtered_keys.map { |k| [k.to_s, values[k]] }] YAML.dump('type' => { title => attributes }).split("\n").drop(2).join("\n") + "\n" end
ruby
def to_hierayaml attributes = Hash[filtered_keys.map { |k| [k.to_s, values[k]] }] YAML.dump('type' => { title => attributes }).split("\n").drop(2).join("\n") + "\n" end
[ "def", "to_hierayaml", "attributes", "=", "Hash", "[", "filtered_keys", ".", "map", "{", "|", "k", "|", "[", "k", ".", "to_s", ",", "values", "[", "k", "]", "]", "}", "]", "YAML", ".", "dump", "(", "'type'", "=>", "{", "title", "=>", "attributes", ...
Convert our resource to yaml for Hiera purposes.
[ "Convert", "our", "resource", "to", "yaml", "for", "Hiera", "purposes", "." ]
7180586da22baa4a78b73d30e7432724593a1754
https://github.com/puppetlabs/puppet-resource_api/blob/7180586da22baa4a78b73d30e7432724593a1754/lib/puppet/resource_api/glue.rb#L39-L42
train
puppetlabs/puppet-resource_api
lib/puppet/resource_api/glue.rb
Puppet::ResourceApi.ResourceShim.filtered_keys
def filtered_keys values.keys.reject { |k| k == :title || !attr_def[k] || (attr_def[k][:behaviour] == :namevar && @namevars.size == 1) } end
ruby
def filtered_keys values.keys.reject { |k| k == :title || !attr_def[k] || (attr_def[k][:behaviour] == :namevar && @namevars.size == 1) } end
[ "def", "filtered_keys", "values", ".", "keys", ".", "reject", "{", "|", "k", "|", "k", "==", ":title", "||", "!", "attr_def", "[", "k", "]", "||", "(", "attr_def", "[", "k", "]", "[", ":behaviour", "]", "==", ":namevar", "&&", "@namevars", ".", "si...
attribute names that are not title or namevars
[ "attribute", "names", "that", "are", "not", "title", "or", "namevars" ]
7180586da22baa4a78b73d30e7432724593a1754
https://github.com/puppetlabs/puppet-resource_api/blob/7180586da22baa4a78b73d30e7432724593a1754/lib/puppet/resource_api/glue.rb#L52-L54
train
puppetlabs/puppet-resource_api
lib/puppet/resource_api/type_definition.rb
Puppet::ResourceApi.TypeDefinition.feature?
def feature?(feature) supported = (definition[:features] && definition[:features].include?(feature)) if supported Puppet.debug("#{definition[:name]} supports `#{feature}`") else Puppet.debug("#{definition[:name]} does not support `#{feature}`") end supported end
ruby
def feature?(feature) supported = (definition[:features] && definition[:features].include?(feature)) if supported Puppet.debug("#{definition[:name]} supports `#{feature}`") else Puppet.debug("#{definition[:name]} does not support `#{feature}`") end supported end
[ "def", "feature?", "(", "feature", ")", "supported", "=", "(", "definition", "[", ":features", "]", "&&", "definition", "[", ":features", "]", ".", "include?", "(", "feature", ")", ")", "if", "supported", "Puppet", ".", "debug", "(", "\"#{definition[:name]} ...
rubocop complains when this is named has_feature?
[ "rubocop", "complains", "when", "this", "is", "named", "has_feature?" ]
7180586da22baa4a78b73d30e7432724593a1754
https://github.com/puppetlabs/puppet-resource_api/blob/7180586da22baa4a78b73d30e7432724593a1754/lib/puppet/resource_api/type_definition.rb#L17-L25
train
puppetlabs/puppet-resource_api
lib/puppet/resource_api/type_definition.rb
Puppet::ResourceApi.BaseTypeDefinition.check_schema
def check_schema(resource, message_prefix = nil) namevars.each do |namevar| if resource[namevar].nil? raise Puppet::ResourceError, "`#{name}.get` did not return a value for the `#{namevar}` namevar attribute" end end message_prefix = 'Provider returned data that does not mat...
ruby
def check_schema(resource, message_prefix = nil) namevars.each do |namevar| if resource[namevar].nil? raise Puppet::ResourceError, "`#{name}.get` did not return a value for the `#{namevar}` namevar attribute" end end message_prefix = 'Provider returned data that does not mat...
[ "def", "check_schema", "(", "resource", ",", "message_prefix", "=", "nil", ")", "namevars", ".", "each", "do", "|", "namevar", "|", "if", "resource", "[", "namevar", "]", ".", "nil?", "raise", "Puppet", "::", "ResourceError", ",", "\"`#{name}.get` did not retu...
validates a resource hash against its type schema
[ "validates", "a", "resource", "hash", "against", "its", "type", "schema" ]
7180586da22baa4a78b73d30e7432724593a1754
https://github.com/puppetlabs/puppet-resource_api/blob/7180586da22baa4a78b73d30e7432724593a1754/lib/puppet/resource_api/type_definition.rb#L127-L152
train
puppetlabs/puppet-resource_api
lib/puppet/resource_api/type_definition.rb
Puppet::ResourceApi.BaseTypeDefinition.check_schema_keys
def check_schema_keys(resource) rejected = [] resource.reject { |key| rejected << key if key != :title && attributes.key?(key) == false } rejected end
ruby
def check_schema_keys(resource) rejected = [] resource.reject { |key| rejected << key if key != :title && attributes.key?(key) == false } rejected end
[ "def", "check_schema_keys", "(", "resource", ")", "rejected", "=", "[", "]", "resource", ".", "reject", "{", "|", "key", "|", "rejected", "<<", "key", "if", "key", "!=", ":title", "&&", "attributes", ".", "key?", "(", "key", ")", "==", "false", "}", ...
Returns an array of keys that where not found in the type schema No longer modifies the resource passed in
[ "Returns", "an", "array", "of", "keys", "that", "where", "not", "found", "in", "the", "type", "schema", "No", "longer", "modifies", "the", "resource", "passed", "in" ]
7180586da22baa4a78b73d30e7432724593a1754
https://github.com/puppetlabs/puppet-resource_api/blob/7180586da22baa4a78b73d30e7432724593a1754/lib/puppet/resource_api/type_definition.rb#L167-L171
train
puppetlabs/puppet-resource_api
lib/puppet/resource_api/type_definition.rb
Puppet::ResourceApi.BaseTypeDefinition.check_schema_values
def check_schema_values(resource) bad_vals = {} resource.each do |key, value| next unless attributes[key] type = @data_type_cache[attributes[key][:type]] is_sensitive = (attributes[key].key?(:sensitive) && (attributes[key][:sensitive] == true)) error_message = Puppet::Resourc...
ruby
def check_schema_values(resource) bad_vals = {} resource.each do |key, value| next unless attributes[key] type = @data_type_cache[attributes[key][:type]] is_sensitive = (attributes[key].key?(:sensitive) && (attributes[key][:sensitive] == true)) error_message = Puppet::Resourc...
[ "def", "check_schema_values", "(", "resource", ")", "bad_vals", "=", "{", "}", "resource", ".", "each", "do", "|", "key", ",", "value", "|", "next", "unless", "attributes", "[", "key", "]", "type", "=", "@data_type_cache", "[", "attributes", "[", "key", ...
Returns a hash of keys and values that are not valid does not modify the resource passed in
[ "Returns", "a", "hash", "of", "keys", "and", "values", "that", "are", "not", "valid", "does", "not", "modify", "the", "resource", "passed", "in" ]
7180586da22baa4a78b73d30e7432724593a1754
https://github.com/puppetlabs/puppet-resource_api/blob/7180586da22baa4a78b73d30e7432724593a1754/lib/puppet/resource_api/type_definition.rb#L175-L193
train
lostisland/faraday_middleware
lib/faraday_middleware/response_middleware.rb
FaradayMiddleware.ResponseMiddleware.parse
def parse(body) if self.class.parser begin self.class.parser.call(body, @parser_options) rescue StandardError, SyntaxError => err raise err if err.is_a? SyntaxError and err.class.name != 'Psych::SyntaxError' raise Faraday::Error::ParsingError, err end el...
ruby
def parse(body) if self.class.parser begin self.class.parser.call(body, @parser_options) rescue StandardError, SyntaxError => err raise err if err.is_a? SyntaxError and err.class.name != 'Psych::SyntaxError' raise Faraday::Error::ParsingError, err end el...
[ "def", "parse", "(", "body", ")", "if", "self", ".", "class", ".", "parser", "begin", "self", ".", "class", ".", "parser", ".", "call", "(", "body", ",", "@parser_options", ")", "rescue", "StandardError", ",", "SyntaxError", "=>", "err", "raise", "err", ...
Parse the response body. Instead of overriding this method, consider using `define_parser`.
[ "Parse", "the", "response", "body", "." ]
09b04ab68288205cc5579aaaf4138012f95268dd
https://github.com/lostisland/faraday_middleware/blob/09b04ab68288205cc5579aaaf4138012f95268dd/lib/faraday_middleware/response_middleware.rb#L48-L59
train
lostisland/faraday_middleware
lib/faraday_middleware/rack_compatible.rb
FaradayMiddleware.RackCompatible.prepare_env
def prepare_env(faraday_env) env = headers_to_rack(faraday_env) url = faraday_env[:url] env['rack.url_scheme'] = url.scheme env['PATH_INFO'] = url.path env['SERVER_PORT'] = url.respond_to?(:inferred_port) ? url.inferred_port : url.port env['QUERY_STRING'] = url.query env['REQU...
ruby
def prepare_env(faraday_env) env = headers_to_rack(faraday_env) url = faraday_env[:url] env['rack.url_scheme'] = url.scheme env['PATH_INFO'] = url.path env['SERVER_PORT'] = url.respond_to?(:inferred_port) ? url.inferred_port : url.port env['QUERY_STRING'] = url.query env['REQU...
[ "def", "prepare_env", "(", "faraday_env", ")", "env", "=", "headers_to_rack", "(", "faraday_env", ")", "url", "=", "faraday_env", "[", ":url", "]", "env", "[", "'rack.url_scheme'", "]", "=", "url", ".", "scheme", "env", "[", "'PATH_INFO'", "]", "=", "url",...
faraday to rack-compatible
[ "faraday", "to", "rack", "-", "compatible" ]
09b04ab68288205cc5579aaaf4138012f95268dd
https://github.com/lostisland/faraday_middleware/blob/09b04ab68288205cc5579aaaf4138012f95268dd/lib/faraday_middleware/rack_compatible.rb#L28-L42
train
lostisland/faraday_middleware
lib/faraday_middleware/rack_compatible.rb
FaradayMiddleware.RackCompatible.restore_env
def restore_env(rack_env) env = rack_env.fetch('faraday') headers = env[:request_headers] headers.clear rack_env.each do |name, value| next unless String === name && String === value if NonPrefixedHeaders.include? name or name.index('HTTP_') == 0 name = name.sub(/^HTTP...
ruby
def restore_env(rack_env) env = rack_env.fetch('faraday') headers = env[:request_headers] headers.clear rack_env.each do |name, value| next unless String === name && String === value if NonPrefixedHeaders.include? name or name.index('HTTP_') == 0 name = name.sub(/^HTTP...
[ "def", "restore_env", "(", "rack_env", ")", "env", "=", "rack_env", ".", "fetch", "(", "'faraday'", ")", "headers", "=", "env", "[", ":request_headers", "]", "headers", ".", "clear", "rack_env", ".", "each", "do", "|", "name", ",", "value", "|", "next", ...
rack to faraday-compatible
[ "rack", "to", "faraday", "-", "compatible" ]
09b04ab68288205cc5579aaaf4138012f95268dd
https://github.com/lostisland/faraday_middleware/blob/09b04ab68288205cc5579aaaf4138012f95268dd/lib/faraday_middleware/rack_compatible.rb#L55-L71
train
wincent/command-t
ruby/command-t/lib/command-t/match_window.rb
CommandT.MatchWindow.match_with_syntax_highlight
def match_with_syntax_highlight(match) highlight_chars = @prompt.abbrev.downcase.scan(/./mu) if @encoding && match.respond_to?(:force_encoding) && match.encoding != @encoding match = match.force_encoding(@encoding) end match.scan(/./mu).inject([]) do |output, char| ...
ruby
def match_with_syntax_highlight(match) highlight_chars = @prompt.abbrev.downcase.scan(/./mu) if @encoding && match.respond_to?(:force_encoding) && match.encoding != @encoding match = match.force_encoding(@encoding) end match.scan(/./mu).inject([]) do |output, char| ...
[ "def", "match_with_syntax_highlight", "(", "match", ")", "highlight_chars", "=", "@prompt", ".", "abbrev", ".", "downcase", ".", "scan", "(", "/", "/mu", ")", "if", "@encoding", "&&", "match", ".", "respond_to?", "(", ":force_encoding", ")", "&&", "match", "...
Highlight matching characters within the matched string. Note that this is only approximate; it will highlight the first matching instances within the string, which may not actually be the instances that were used by the matching/scoring algorithm to determine the best score for the match.
[ "Highlight", "matching", "characters", "within", "the", "matched", "string", "." ]
792d6079d32f1973c142c6fab89d2fdc94019ac8
https://github.com/wincent/command-t/blob/792d6079d32f1973c142c6fab89d2fdc94019ac8/ruby/command-t/lib/command-t/match_window.rb#L408-L423
train
wincent/command-t
ruby/command-t/lib/command-t/match_window.rb
CommandT.MatchWindow.print_match
def print_match(idx) return unless VIM::Window.select(@window) unlock @@buffer[line(idx)] = match_text_for_idx idx lock end
ruby
def print_match(idx) return unless VIM::Window.select(@window) unlock @@buffer[line(idx)] = match_text_for_idx idx lock end
[ "def", "print_match", "(", "idx", ")", "return", "unless", "VIM", "::", "Window", ".", "select", "(", "@window", ")", "unlock", "@@buffer", "[", "line", "(", "idx", ")", "]", "=", "match_text_for_idx", "idx", "lock", "end" ]
Print just the specified match.
[ "Print", "just", "the", "specified", "match", "." ]
792d6079d32f1973c142c6fab89d2fdc94019ac8
https://github.com/wincent/command-t/blob/792d6079d32f1973c142c6fab89d2fdc94019ac8/ruby/command-t/lib/command-t/match_window.rb#L426-L431
train
wincent/command-t
ruby/command-t/lib/command-t/match_window.rb
CommandT.MatchWindow.print_matches
def print_matches match_count = @matches.length if match_count == 0 print_error 'NO MATCHES' else return unless VIM::Window.select(@window) unlock clear @window_width = @window.width # update cached value desired_lines = [match_count, @min_height].max ...
ruby
def print_matches match_count = @matches.length if match_count == 0 print_error 'NO MATCHES' else return unless VIM::Window.select(@window) unlock clear @window_width = @window.width # update cached value desired_lines = [match_count, @min_height].max ...
[ "def", "print_matches", "match_count", "=", "@matches", ".", "length", "if", "match_count", "==", "0", "print_error", "'NO MATCHES'", "else", "return", "unless", "VIM", "::", "Window", ".", "select", "(", "@window", ")", "unlock", "clear", "@window_width", "=", ...
Print all matches.
[ "Print", "all", "matches", "." ]
792d6079d32f1973c142c6fab89d2fdc94019ac8
https://github.com/wincent/command-t/blob/792d6079d32f1973c142c6fab89d2fdc94019ac8/ruby/command-t/lib/command-t/match_window.rb#L438-L464
train
wincent/command-t
ruby/command-t/lib/command-t/controller.rb
CommandT.Controller.quickfix
def quickfix hide matches = @matches.map do |match| "{ 'filename': '#{VIM::escape_for_single_quotes match}' }" end.join(', ') ::VIM::command 'call setqflist([' + matches + '])' ::VIM::command 'cope' end
ruby
def quickfix hide matches = @matches.map do |match| "{ 'filename': '#{VIM::escape_for_single_quotes match}' }" end.join(', ') ::VIM::command 'call setqflist([' + matches + '])' ::VIM::command 'cope' end
[ "def", "quickfix", "hide", "matches", "=", "@matches", ".", "map", "do", "|", "match", "|", "\"{ 'filename': '#{VIM::escape_for_single_quotes match}' }\"", "end", ".", "join", "(", "', '", ")", "::", "VIM", "::", "command", "'call setqflist(['", "+", "matches", "+...
Take current matches and stick them in the quickfix window.
[ "Take", "current", "matches", "and", "stick", "them", "in", "the", "quickfix", "window", "." ]
792d6079d32f1973c142c6fab89d2fdc94019ac8
https://github.com/wincent/command-t/blob/792d6079d32f1973c142c6fab89d2fdc94019ac8/ruby/command-t/lib/command-t/controller.rb#L168-L177
train
wincent/command-t
ruby/command-t/lib/command-t/prompt.rb
CommandT.Prompt.backspace!
def backspace! if @col > 0 left, cursor, right = abbrev_segments @abbrev = left.chop! + cursor + right @col -= 1 redraw end end
ruby
def backspace! if @col > 0 left, cursor, right = abbrev_segments @abbrev = left.chop! + cursor + right @col -= 1 redraw end end
[ "def", "backspace!", "if", "@col", ">", "0", "left", ",", "cursor", ",", "right", "=", "abbrev_segments", "@abbrev", "=", "left", ".", "chop!", "+", "cursor", "+", "right", "@col", "-=", "1", "redraw", "end", "end" ]
Delete a character to the left of the current cursor position.
[ "Delete", "a", "character", "to", "the", "left", "of", "the", "current", "cursor", "position", "." ]
792d6079d32f1973c142c6fab89d2fdc94019ac8
https://github.com/wincent/command-t/blob/792d6079d32f1973c142c6fab89d2fdc94019ac8/ruby/command-t/lib/command-t/prompt.rb#L56-L63
train
afair/email_address
lib/email_address/local.rb
EmailAddress.Local.format
def format(form=@config[:local_format]||:conventional) if @config[:local_format].is_a?(Proc) @config[:local_format].call(self) elsif form == :conventional self.conventional elsif form == :canonical self.canonical elsif form == :relaxed self.relax elsif form ...
ruby
def format(form=@config[:local_format]||:conventional) if @config[:local_format].is_a?(Proc) @config[:local_format].call(self) elsif form == :conventional self.conventional elsif form == :canonical self.canonical elsif form == :relaxed self.relax elsif form ...
[ "def", "format", "(", "form", "=", "@config", "[", ":local_format", "]", "||", ":conventional", ")", "if", "@config", "[", ":local_format", "]", ".", "is_a?", "(", "Proc", ")", "@config", "[", ":local_format", "]", ".", "call", "(", "self", ")", "elsif",...
Builds the local string according to configurations
[ "Builds", "the", "local", "string", "according", "to", "configurations" ]
6c720b37061a52a92e84db90df0a8b5eef3de39a
https://github.com/afair/email_address/blob/6c720b37061a52a92e84db90df0a8b5eef3de39a/lib/email_address/local.rb#L188-L200
train
afair/email_address
lib/email_address/local.rb
EmailAddress.Local.standard
def standard form = self.mailbox form += @config[:tag_separator] + self.tag if self.tag form += "(" + self.comment + ")" if self.comment form.gsub!(/([\\\"])/, '\\\1') # Escape \ and " if form =~ /[ \"\(\),:<>@\[\\\]]/ # Space and "(),:;<>@[\] form = %Q("#{form}") end f...
ruby
def standard form = self.mailbox form += @config[:tag_separator] + self.tag if self.tag form += "(" + self.comment + ")" if self.comment form.gsub!(/([\\\"])/, '\\\1') # Escape \ and " if form =~ /[ \"\(\),:<>@\[\\\]]/ # Space and "(),:;<>@[\] form = %Q("#{form}") end f...
[ "def", "standard", "form", "=", "self", ".", "mailbox", "form", "+=", "@config", "[", ":tag_separator", "]", "+", "self", ".", "tag", "if", "self", ".", "tag", "form", "+=", "\"(\"", "+", "self", ".", "comment", "+", "\")\"", "if", "self", ".", "comm...
Returns a normalized version of the standard address parts.
[ "Returns", "a", "normalized", "version", "of", "the", "standard", "address", "parts", "." ]
6c720b37061a52a92e84db90df0a8b5eef3de39a
https://github.com/afair/email_address/blob/6c720b37061a52a92e84db90df0a8b5eef3de39a/lib/email_address/local.rb#L229-L238
train
afair/email_address
lib/email_address/local.rb
EmailAddress.Local.conventional?
def conventional? self.syntax = :invalid self.local =~ CONVENTIONAL_MAILBOX_REGEX or return false self.valid_size? or return false self.valid_encoding? or return false self.syntax = :conventional true end
ruby
def conventional? self.syntax = :invalid self.local =~ CONVENTIONAL_MAILBOX_REGEX or return false self.valid_size? or return false self.valid_encoding? or return false self.syntax = :conventional true end
[ "def", "conventional?", "self", ".", "syntax", "=", ":invalid", "self", ".", "local", "=~", "CONVENTIONAL_MAILBOX_REGEX", "or", "return", "false", "self", ".", "valid_size?", "or", "return", "false", "self", ".", "valid_encoding?", "or", "return", "false", "self...
True if the part matches the conventional format
[ "True", "if", "the", "part", "matches", "the", "conventional", "format" ]
6c720b37061a52a92e84db90df0a8b5eef3de39a
https://github.com/afair/email_address/blob/6c720b37061a52a92e84db90df0a8b5eef3de39a/lib/email_address/local.rb#L329-L336
train
afair/email_address
lib/email_address/local.rb
EmailAddress.Local.relaxed?
def relaxed? self.syntax = :invalid self.valid_size? or return false self.valid_encoding? or return false if self.local =~ RELAXED_MAILBOX_REGEX self.syntax = :relaxed true else false end end
ruby
def relaxed? self.syntax = :invalid self.valid_size? or return false self.valid_encoding? or return false if self.local =~ RELAXED_MAILBOX_REGEX self.syntax = :relaxed true else false end end
[ "def", "relaxed?", "self", ".", "syntax", "=", ":invalid", "self", ".", "valid_size?", "or", "return", "false", "self", ".", "valid_encoding?", "or", "return", "false", "if", "self", ".", "local", "=~", "RELAXED_MAILBOX_REGEX", "self", ".", "syntax", "=", ":...
Relaxed conventional is not so strict about character order.
[ "Relaxed", "conventional", "is", "not", "so", "strict", "about", "character", "order", "." ]
6c720b37061a52a92e84db90df0a8b5eef3de39a
https://github.com/afair/email_address/blob/6c720b37061a52a92e84db90df0a8b5eef3de39a/lib/email_address/local.rb#L339-L349
train
afair/email_address
lib/email_address/local.rb
EmailAddress.Local.standard?
def standard? self.syntax = :invalid self.valid_size? or return false self.valid_encoding? or return false if self.local =~ STANDARD_LOCAL_REGEX self.syntax = :standard true else false end end
ruby
def standard? self.syntax = :invalid self.valid_size? or return false self.valid_encoding? or return false if self.local =~ STANDARD_LOCAL_REGEX self.syntax = :standard true else false end end
[ "def", "standard?", "self", ".", "syntax", "=", ":invalid", "self", ".", "valid_size?", "or", "return", "false", "self", ".", "valid_encoding?", "or", "return", "false", "if", "self", ".", "local", "=~", "STANDARD_LOCAL_REGEX", "self", ".", "syntax", "=", ":...
True if the part matches the RFC standard format
[ "True", "if", "the", "part", "matches", "the", "RFC", "standard", "format" ]
6c720b37061a52a92e84db90df0a8b5eef3de39a
https://github.com/afair/email_address/blob/6c720b37061a52a92e84db90df0a8b5eef3de39a/lib/email_address/local.rb#L352-L362
train
afair/email_address
lib/email_address/local.rb
EmailAddress.Local.matches?
def matches?(*rules) rules.flatten.each do |r| if r =~ /(.+)@\z/ return r if File.fnmatch?($1, self.local) end end false end
ruby
def matches?(*rules) rules.flatten.each do |r| if r =~ /(.+)@\z/ return r if File.fnmatch?($1, self.local) end end false end
[ "def", "matches?", "(", "*", "rules", ")", "rules", ".", "flatten", ".", "each", "do", "|", "r", "|", "if", "r", "=~", "/", "\\z", "/", "return", "r", "if", "File", ".", "fnmatch?", "(", "$1", ",", "self", ".", "local", ")", "end", "end", "fals...
Matches configured formated form against File glob strings given. Rules must end in @ to distinguish themselves from other email part matches.
[ "Matches", "configured", "formated", "form", "against", "File", "glob", "strings", "given", ".", "Rules", "must", "end", "in" ]
6c720b37061a52a92e84db90df0a8b5eef3de39a
https://github.com/afair/email_address/blob/6c720b37061a52a92e84db90df0a8b5eef3de39a/lib/email_address/local.rb#L366-L373
train
afair/email_address
lib/email_address/address.rb
EmailAddress.Address.canonical
def canonical c = self.local.canonical c += "@" + self.host.canonical if self.host.canonical && self.host.canonical > " " c end
ruby
def canonical c = self.local.canonical c += "@" + self.host.canonical if self.host.canonical && self.host.canonical > " " c end
[ "def", "canonical", "c", "=", "self", ".", "local", ".", "canonical", "c", "+=", "\"@\"", "+", "self", ".", "host", ".", "canonical", "if", "self", ".", "host", ".", "canonical", "&&", "self", ".", "host", ".", "canonical", ">", "\" \"", "c", "end" ]
Returns the canonical email address according to the provider uniqueness rules. Usually, this downcases the address, removes spaves and comments and tags, and any extraneous part of the address not considered a unique account by the provider.
[ "Returns", "the", "canonical", "email", "address", "according", "to", "the", "provider", "uniqueness", "rules", ".", "Usually", "this", "downcases", "the", "address", "removes", "spaves", "and", "comments", "and", "tags", "and", "any", "extraneous", "part", "of"...
6c720b37061a52a92e84db90df0a8b5eef3de39a
https://github.com/afair/email_address/blob/6c720b37061a52a92e84db90df0a8b5eef3de39a/lib/email_address/address.rb#L125-L129
train
afair/email_address
lib/email_address/exchanger.rb
EmailAddress.Exchanger.provider
def provider return @provider if defined? @provider EmailAddress::Config.providers.each do |provider, config| if config[:exchanger_match] && self.matches?(config[:exchanger_match]) return @provider = provider end end @provider = :default end
ruby
def provider return @provider if defined? @provider EmailAddress::Config.providers.each do |provider, config| if config[:exchanger_match] && self.matches?(config[:exchanger_match]) return @provider = provider end end @provider = :default end
[ "def", "provider", "return", "@provider", "if", "defined?", "@provider", "EmailAddress", "::", "Config", ".", "providers", ".", "each", "do", "|", "provider", ",", "config", "|", "if", "config", "[", ":exchanger_match", "]", "&&", "self", ".", "matches?", "(...
Returns the provider name based on the MX-er host names, or nil if not matched
[ "Returns", "the", "provider", "name", "based", "on", "the", "MX", "-", "er", "host", "names", "or", "nil", "if", "not", "matched" ]
6c720b37061a52a92e84db90df0a8b5eef3de39a
https://github.com/afair/email_address/blob/6c720b37061a52a92e84db90df0a8b5eef3de39a/lib/email_address/exchanger.rb#L37-L45
train
afair/email_address
lib/email_address/exchanger.rb
EmailAddress.Exchanger.domains
def domains @_domains ||= mxers.map {|m| EmailAddress::Host.new(m.first).domain_name }.sort.uniq end
ruby
def domains @_domains ||= mxers.map {|m| EmailAddress::Host.new(m.first).domain_name }.sort.uniq end
[ "def", "domains", "@_domains", "||=", "mxers", ".", "map", "{", "|", "m", "|", "EmailAddress", "::", "Host", ".", "new", "(", "m", ".", "first", ")", ".", "domain_name", "}", ".", "sort", ".", "uniq", "end" ]
Returns Array of domain names for the MX'ers, used to determine the Provider
[ "Returns", "Array", "of", "domain", "names", "for", "the", "MX", "ers", "used", "to", "determine", "the", "Provider" ]
6c720b37061a52a92e84db90df0a8b5eef3de39a
https://github.com/afair/email_address/blob/6c720b37061a52a92e84db90df0a8b5eef3de39a/lib/email_address/exchanger.rb#L72-L74
train
openzipkin/zipkin-ruby
lib/zipkin-tracer/hostname_resolver.rb
ZipkinTracer.HostnameResolver.unique_hosts
def unique_hosts(spans) hosts = [] each_endpoint(spans) do |endpoint| hosts.push(endpoint) end hosts.uniq end
ruby
def unique_hosts(spans) hosts = [] each_endpoint(spans) do |endpoint| hosts.push(endpoint) end hosts.uniq end
[ "def", "unique_hosts", "(", "spans", ")", "hosts", "=", "[", "]", "each_endpoint", "(", "spans", ")", "do", "|", "endpoint", "|", "hosts", ".", "push", "(", "endpoint", ")", "end", "hosts", ".", "uniq", "end" ]
Using this to resolve only once per host
[ "Using", "this", "to", "resolve", "only", "once", "per", "host" ]
ce914d2fd9993fe898ba373595d9d43cd03c4e03
https://github.com/openzipkin/zipkin-ruby/blob/ce914d2fd9993fe898ba373595d9d43cd03c4e03/lib/zipkin-tracer/hostname_resolver.rb#L43-L49
train
zendesk/delivery_boy
lib/delivery_boy/instance.rb
DeliveryBoy.Instance.producer_options
def producer_options { required_acks: config.required_acks, ack_timeout: config.ack_timeout, max_retries: config.max_retries, retry_backoff: config.retry_backoff, max_buffer_size: config.max_buffer_size, max_buffer_bytesize: config.max_buffer_bytesize, compr...
ruby
def producer_options { required_acks: config.required_acks, ack_timeout: config.ack_timeout, max_retries: config.max_retries, retry_backoff: config.retry_backoff, max_buffer_size: config.max_buffer_size, max_buffer_bytesize: config.max_buffer_bytesize, compr...
[ "def", "producer_options", "{", "required_acks", ":", "config", ".", "required_acks", ",", "ack_timeout", ":", "config", ".", "ack_timeout", ",", "max_retries", ":", "config", ".", "max_retries", ",", "retry_backoff", ":", "config", ".", "retry_backoff", ",", "m...
Options for both the sync and async producers.
[ "Options", "for", "both", "the", "sync", "and", "async", "producers", "." ]
077e9e451267e1a64aa25733e08ff36ff4e7f2f4
https://github.com/zendesk/delivery_boy/blob/077e9e451267e1a64aa25733e08ff36ff4e7f2f4/lib/delivery_boy/instance.rb#L85-L96
train
moove-it/sidekiq-scheduler
lib/sidekiq-scheduler/schedule.rb
SidekiqScheduler.Schedule.get_schedule
def get_schedule(name = nil) if name.nil? get_all_schedules else encoded_schedule = SidekiqScheduler::RedisManager.get_job_schedule(name) encoded_schedule.nil? ? nil : JSON.parse(encoded_schedule) end end
ruby
def get_schedule(name = nil) if name.nil? get_all_schedules else encoded_schedule = SidekiqScheduler::RedisManager.get_job_schedule(name) encoded_schedule.nil? ? nil : JSON.parse(encoded_schedule) end end
[ "def", "get_schedule", "(", "name", "=", "nil", ")", "if", "name", ".", "nil?", "get_all_schedules", "else", "encoded_schedule", "=", "SidekiqScheduler", "::", "RedisManager", ".", "get_job_schedule", "(", "name", ")", "encoded_schedule", ".", "nil?", "?", "nil"...
Retrive the schedule configuration for the given name if the name is nil it returns a hash with all the names end their schedules.
[ "Retrive", "the", "schedule", "configuration", "for", "the", "given", "name", "if", "the", "name", "is", "nil", "it", "returns", "a", "hash", "with", "all", "the", "names", "end", "their", "schedules", "." ]
25d3406044196dfb58d74caac920c9a2991eb486
https://github.com/moove-it/sidekiq-scheduler/blob/25d3406044196dfb58d74caac920c9a2991eb486/lib/sidekiq-scheduler/schedule.rb#L71-L78
train