Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $all_data = Hash.new
- class Car
- def collect_data(id,mass,engine_type,build,brand)
- @local_array_value = [mass,engine_type,build,brand]
- @id = id
- $all_data.merge!(@id => @local_array_value)
- end
- end
- def add_car(id,mass,engine_type,build,brand)
- @id = id
- @id = Car.new
- @id.collect_data(id,mass,engine_type,build,brand)
- end
- add_car("1x","2mass","engine_type23","2build","brandx23")
- add_car("2x","2mass","engine_type23","2build","brandx23")
- add_car("3x","2mass","engine_type23","2build","brandx23")
- add_car("4x","2mass","engine_type23","2build","brandx23")
- puts $all_data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement