<commit_before>module Noodnik
	module NagsHelper
		def nag_user_to(topic, &block)
			nag = find_nag(topic)
			return if nag && nag.next_nag > Time.now

			begin
	 		  class_eval('alias :original_link_to :link_to')
		    class_eval('alias :link_to :my_custom_link_to')
				Context.new.local_eval do
					@noodnik_topic = topic
					block.call
				end
		  ensure
				@noodnik_topic = nil
		    class_eval('alias :link_to :original_link_to')
		  end
		end

		private

		def find_nag(topic)
			attr = { user_id: Noodnik.current_user_id.call, topic: topic }
			Nag.find :first, conditions: attr
		end

		def my_custom_link_to(*args)
			has_options = args.last.is_a? Hash
			html_options = has_options ? args.last : {}
			html_options["data_noodnik_topic"] = @noodnik_topic
			args << html_options unless has_options
			original_link_to *args
		end

		class Context
			include Rails.application.routes.mounted_helpers
		  def postpone_for(period)
				link_to "Remind me in #{period.inspect}", noodnik.routes.url_helpers.postpone_path(period: period, topic: @noodnik_topic), class: 'postpone-link'
			end
		end
	end
end
<commit_msg>Added postpone_for and link_to overrides in nag_user_to<commit_after>module Noodnik
	module NagsHelper
		def nag_user_to(topic)
			nag = find_nag(topic)
			return if nag && nag.next_nag > Time.now
			content_tag :div, :"data-noodnik-topic" => topic do
				yield
			end
		end

		def postpone_for(period)
			link_to "Remind me in #{period.inspect}", noodnik.routes.url_helpers.postpone_path(period: period, topic: @noodnik_topic), class: 'postpone-link'
		end

		private

		def find_nag(topic)
			attr = { user_id: Noodnik.current_user_id.call, topic: topic }
			Nag.find :first, conditions: attr
		end
	end
end

{'fraction_non_alphanumeric': 0.09279538904899136, 'fraction_numerical': 0.0, 'mean_word_length': 3.8627450980392157, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5196637', 'n_tokens_mistral': 733, 'n_tokens_neox': 635, 'n_words': 142}