Sha256: b5609a014908e69188fd77e17dee077e6684931e888b11cb952a50228608bb64
Contents?: true
Size: 926 Bytes
Versions: 4
Compression:
Stored size: 926 Bytes
Contents
unless defined?(User) class User attr_accessor :age, :city, :name, :first, :float, :hobbies, :twitter DEFAULT_AGE = 24 DEFAULT_CITY = 'irvine' DEFAULT_NAME = 'rabl' DEFAULT_FIRST = 'bob' DEFAULT_FLOAT = 1234.56 DEFAULT_HOBBIES = ['Photography'] DEFAULT_TWITTER = 'rablgem' def initialize(attributes={}) %w(age city name first float hobbies twitter).each do |attr| self.send "#{attr}=", (attributes.has_key?(attr.to_sym) ? attributes[attr.to_sym] : self.class.const_get("DEFAULT_#{attr.upcase}")) end self.hobbies = self.hobbies.map { |h| Hobby.new(h) } end end class Hobby attr_accessor :name def initialize(name); @name = name; end end end unless defined?(NestedScope::User) module NestedScope class User def controller; self; end def controller_name; self.class.name.downcase; end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rabl-0.11.1 | test/models/user.rb |
rabl-0.11.0 | test/models/user.rb |
rabl-0.10.1 | test/models/user.rb |
rabl-0.10.0 | test/models/user.rb |