define_method in Ruby

define_method is a (private) method of the object Class. You are calling it from an instance. define_method(:my_method) do |foo, bar| # or even |*args| # do something end or, you could even use string interpolation in the method name, such as define_method("#{attribute}=") do |unencrypted_password| if unencrypted_password.nil? self.send("#{attribute}_digest=", nil) elsif !unencrypted_password.empty? instance_variable_set("@#{attribute}", unencrypted_password) cost = ActiveModel::SecurePassword.min_cost … Continue reading define_method in Ruby

How to make a custom build version (e.g., Ruby, Python, etc.) in Sublime Text 3

It looks like Sublime Text 3 uses OSX-default version of Ruby in build mode. I would like to change the version, since I'm using a newer one. I found some answers for privious version of sublime: How to edit a native build system in Sublime Text 2? Setting and changing build systems in Sublime Text … Continue reading How to make a custom build version (e.g., Ruby, Python, etc.) in Sublime Text 3

Why Rails 4 Live Streaming is a big deal

TLDR: Rails Live Streaming allows Rails to compete with Node.js in the streaming arena. Streaming requires application servers to support either multi-threaded or evented I/O. Most Ruby application servers are not up for the job. Phusion Passenger Enterprise 4.0 (a Ruby app server) is to become hybrid multi-processed, multi-threaded and evented. This allows seamless support … Continue reading Why Rails 4 Live Streaming is a big deal