{"id":17681661,"url":"https://github.com/epoch/checkpoint2","last_synced_at":"2025-04-19T17:13:09.623Z","repository":{"id":138802568,"uuid":"152672294","full_name":"epoch/checkpoint2","owner":"epoch","description":null,"archived":false,"fork":false,"pushed_at":"2018-10-12T02:03:11.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T10:43:33.243Z","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/epoch.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":"2018-10-12T00:34:53.000Z","updated_at":"2018-10-12T02:03:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"ecabeb57-e62c-4085-b861-d22453c06999","html_url":"https://github.com/epoch/checkpoint2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epoch%2Fcheckpoint2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epoch%2Fcheckpoint2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epoch%2Fcheckpoint2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epoch%2Fcheckpoint2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epoch","download_url":"https://codeload.github.com/epoch/checkpoint2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249746048,"owners_count":21319581,"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","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-24T09:11:48.674Z","updated_at":"2025-04-19T17:13:09.605Z","avatar_url":"https://github.com/epoch.png","language":"Ruby","readme":"1. fork this repo\n2. clone your repo to your computer\n3. make a new directory with your name\n4. put your answers in this directory\n5. make a commit for every question\n6. make a pull request before time is up!!!\n\n\n# Question 1\nDefine a method called `offer_rose`, which should take one argument named `person` (String).\nWhen called the method should print to the terminal:\n\"Would you take this rose, `person`, in exchange for giving an old beggar woman shelter from the bitter cold?\" --\u003e\ndef offer_rose string\n    puts  \"Would you take this rose, `person`, in exchange for giving an old beggar woman shelter from the bitter cold?\"\nend\n\noffer_rose('person')\n# Question 2\nAssume the following hash...\n```ruby\ntown = {\n  residents: [\"Maurice\", \"Belle\", \"Gaston\"],\n  castle: {\n    num_rooms: 47,\n    residents: [\"Robby Benson\"],\n    guests: []\n  }\n}\n```\nUsing Ruby...\n- Remove \"Belle\" from `residents`\n- Add \"Belle\" to the `guests` array\nType your solution directly below this line:\n\n\ntown[:residents].delete('Belle')\ntown[:guests] = ['Belle']\n\n\n\n# Question 3\nAssume you have an array of strings representing friends' names...\n```ruby\nfriends = [\"Chip Potts\", \"Cogsworth\", \"Lumière\", \"Mrs. Potts\"]\n```\nUsing a loop and string interpolation, print each string in `friends` to the Terminal...\n```ruby\n\"Belle is friends with Chip Potts\"\n\"Belle is friends with Cogsworth\"\n\"Belle is friends with Lumière\"\n\"Belle is friends with Mrs. Potts\"\n```\nfriends.each do |friend|\n   p  \"Belle is friends with #{friend}\"\nend\n\n\n\n# Question 4\nAssume the following array of hashes:\n```ruby\nlost_boys = [\n  {name: 'Tootles', age: 11},\n  {name: 'Nibs', age: 9},\n  {name: 'Slightly', age: 10},\n  {name: 'Curly', age: 8},\n  {name: 'The Twins', age: 9}\n]\n```\nUse `.each` to iterate over the `lost_boys` array and increase each boy's age by 30 years.\n\nlost_boys.each { |name|\n     name[:age] += 10\n}\n\n\n# Question 5\nAssume the following array:\n```ruby\nchildren = ['Wendy', 'John', 'Michael']\n```\nUse `.map` to iterate through the `children` array and add ` Darling` to the end\nof their names. Assign the returned array to a variable called `darling_children`.\nExample: `Wendy` should become `Wendy Darling` in the new array.\n\ndarling_children = children.map {|name|\n    darling_children = []\n    name = \"#{name} Darling\"\n}\n# Question 6\nDefine a Ruby class called `Animal`. Each `Animal` should have...\n- A `name` (String) attribute\n- A `greet` instance method\n- The ability to \"get\" and \"set\" `name`\nclass Animal \n\n\n    def set_name\n        @name = get_name().chomp\n    end\n    \n    def get_name \n        @name = gets \n    end\n\n    def greets\n        \"#{@name} says hello\"\n    end\n\nend\n\nanimal = Animal.new\n\n\n# Question 7\nCreate a new `Animal` instance with the name \"Pumba\" an assign it to a variable named `pumba`.\n\n\n# Question 8\n\nWrite a method called `toonify` that takes two parameters, `accent` and `sentence`.\n- If `accent` is the string `\"daffy\"`, return a modified version of `sentence` with all \"s\" replaced with \"th\".\n- If the accent is `\"elmer\"`, replace all \"r\" with \"w\".\n- Feel free to add your own accents as well!\n- If the accent is not recognized, just return the sentence as-is.\n\n```ruby\ntoonify \"daffy\", \"so you smell like sausage\"\n#=\u003e \"tho you thmell like thauthage\"\n```\nCall the method twice with different arguments","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepoch%2Fcheckpoint2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepoch%2Fcheckpoint2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepoch%2Fcheckpoint2/lists"}