Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9dc83a3b53
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (31 sloc) 0.764 kb
begin
require 'rubygems'
require 'test/unit'
require 'active_support'
require 'active_support/inflector'
if RUBY_VERSION >= "1.9.0"
require 'csv'
else
require 'fastercsv'
end
require File.dirname(__FILE__) + '/../lib/to_csv'
rescue LoadError
puts 'to_csv tests rely on active_support, and fastercsv if ruby version < 1.9'
end
class User
COLUMNS = %w(id name age)
attr_accessor *COLUMNS
def self.human_attribute_name(attribute)
attribute.to_s.humanize
end
def initialize(params={})
params.each { |key, value| self.send("#{key}=", value); }
self
end
def attributes
COLUMNS.inject({}) { |attributes, attribute| attributes.merge(attribute => send(attribute)) }
end
def is_old?
age > 40
end
end
Jump to Line
Something went wrong with that request. Please try again.