All Problems Matching 'ruby'
class PreferRefactor < BasicEvent def initialize problem, refactor, user @problem = problem @refactor = refactor @user = user end def strategy # <more>
Here's the code for preferring a refactor on the site. It's part of a domain event using a framework I wrote (https://github.com/desmondmonster/happenings) and handles the validations, data changes, etc. This keeps the models simple (
#not_preferred! just update an...
def foo @results =  stuff.each do |thing| @results << thing if is_cool?(thing) end @results end
What is a better way of doing this?
class Apn @@config ||= YAML.load_file('config/apn.yml')[Rails.env] def initialize user_id @user_id = user_id @tokens = Client.where(user_id: user_id).pluck(:device_token).compact end # <more>
class CookieStore include ::Capybara::DSL class << self def set_cookies(user_id, cookies) Resque.redis.hset("cookies", user_id, cookies.join("desmond")) end def get_cookies(user_id) # <more>
I'm looking for a good way to clean up line #20. It seems there should be a good way of reusing the result of #all? in the #remove_cookies side effect.