Sha256: a103f3aa4ae56ab6cac7584f99fdacea35f0946518726022c9f4a5568aa7b7af
Contents?: true
Size: 523 Bytes
Versions: 7
Compression:
Stored size: 523 Bytes
Contents
class Car < Struct.new(:brand, :type, :number_of_doors, :stock, :launch_date) COLLECTION = [ [ 'Audi', 'A4', 3, 100, Date.new(2016, 1, 1) ], [ 'Citroën', 'C4 Picasso', 5, 150, Date.new(2016, 2, 1) ], [ 'Ferrari', 'F12', 3, 2, Date.new(2016, 3, 1) ] ] def self.collection COLLECTION.map do |data| self.new( *data ) end end end class CarWithHumanAttributeName < Car def self.human_attribute_name(attribute) attribute.to_s.gsub('_', ' ').capitalize end end
Version data entries
7 entries across 7 versions & 1 rubygems