Thursday, February 20, 2014

SimpleDelegator in Ruby

require 'delegate'

class User
  def born_on
    'July 21'

class UserDecorator < SimpleDelegator
  def birth_year

decorated_user =
p decorated_user.birth_year  #=> July 21

Friday, February 14, 2014

psych.rb in `parse': found a tab character that violate intendation while scanning a plain scalar at

You will not be able to go the rails console. Go to the root directory of the rails project and fire up an irb session:
1. require 'yaml'
2. YAML::ENGINE.yamler = 'psych'
3. YAML.load_file('config/your-config-file.yml')

This will reproduce the problem. See the line number of row to find the syntax error. Fix it by changing the tab to space.