{"id":16078607,"url":"https://github.com/condef5/ruby-workshop-i","last_synced_at":"2025-11-17T14:36:25.704Z","repository":{"id":71130887,"uuid":"332307068","full_name":"condef5/ruby-workshop-I","owner":"condef5","description":null,"archived":false,"fork":false,"pushed_at":"2021-01-25T04:47:56.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T02:48:25.530Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/condef5.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-23T21:01:02.000Z","updated_at":"2023-05-03T20:31:39.000Z","dependencies_parsed_at":"2023-04-13T16:39:44.115Z","dependency_job_id":null,"html_url":"https://github.com/condef5/ruby-workshop-I","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/condef5/ruby-workshop-I","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/condef5%2Fruby-workshop-I","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/condef5%2Fruby-workshop-I/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/condef5%2Fruby-workshop-I/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/condef5%2Fruby-workshop-I/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/condef5","download_url":"https://codeload.github.com/condef5/ruby-workshop-I/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/condef5%2Fruby-workshop-I/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284900429,"owners_count":27081692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-17T02:00:06.431Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T10:20:38.003Z","updated_at":"2025-11-17T14:36:25.676Z","avatar_url":"https://github.com/condef5.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ruby Workshop\n\nThe purpose of these exercises is to train you on how to\nuse classes, operator overloading and linked list in ruby.\n\n# Exercises\n\n1. DPokemon\n\nA DPokemon is a pokemon profile that shows the name and the power level of a particular pokemon.\nIn some cases, this pokemon meets other pokemons, and it wants to compare levels and know which is the strongest.\n\nYour task here is to implement a DPokemon class and provide the necessary methods to compare the pokemon levels.\n\n* Implement main class\n```\nlugia = DPokemon.new(\"lugia\", 2000)\npikachu = DPokemon.new(\"pikachu\", 2000)\n```\n\n* Implement equal method(==)\n\n```\nlugia == pikachu # false\n```\n\n* Implement stronger method(\u003e)\n\n```\nlugia \u003e pikachu # true\n```\n\n* Implement less strong method(\u003c)\n```\nlugia \u003c pikachu # false\n```\n\n\n2. FixedArray\n\nA FixedArray is an array that always has a fixed number of elements.\n\nYour task here is write a class that implements a fixed-length array, and provides the\nnecessary methods to support the following code:\n\n* Implement main class\n```ruby\nfixed_array = FixedArray.new(5)\n```\n\n* Setting a element to position\n```ruby\nfixed_array[3] = 12\nputs fixed_array # nil, nil, nil, 12, nil\n```\n\n* Retrieve an element\n```ruby\nfixed_array[3] # 12\n```\n\n* Support errors\n```ruby\nfixed_array[6] # raise an IndexError\n```\n\n* Convert to array\n```ruby\nputs fixed_array.to_a # [nil, nil, nil, 12, nil]\n```\n\n* Convert to string\n```ruby\nputs fixed_array.to_s # '[nil, \"c\", nil, \"a\", \"d\"]'\n```\n\n\n3. SuperFibo\n\nHave you heard of Leonardo Pisano? Not yet? Don't worry, He invented a famous succession\n\n```\n0 1 1 2 3 5 8 13\n```\n\nMaybe now you have an idea, this is the fibonacci sequence.\n\nYour task here will be to implement a fibonacci sequence with objects:\n\nExample of code:\n\n```ruby\nzero = SuperFibo.new\none = zero.next\nputs one.value # 1\n\nanother_one = one.next\nputs another_one.value # 1\n\nputs another_one.next.value # 2\nputs another_one.next.next.value # 3\n```\n\n# Running the tests\n\nAfter you finish an exercise, you need to go that exercise test in the `test` folder\nand remove the comment operator, like this:\n\n```diff\n- class FixedArrayTest # \u003c Minitest::Test\n+ class FixedArrayTest \u003c Minitest::Test\n```\n\nThen you can run the tests with this command:\n```bash\nrake test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcondef5%2Fruby-workshop-i","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcondef5%2Fruby-workshop-i","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcondef5%2Fruby-workshop-i/lists"}