{"action":"opened","issue":{"url":"https://api.github.com/repos/lemonsweets/oystercard/issues/17","labels_url":"https://api.github.com/repos/lemonsweets/oystercard/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/lemonsweets/oystercard/issues/17/comments","events_url":"https://api.github.com/repos/lemonsweets/oystercard/issues/17/events","html_url":"https://github.com/lemonsweets/oystercard/issues/17","id":101052387,"number":17,"title":"penalty_fare.md","user":{"login":"lemonsweets","id":12461822,"avatar_url":"https://avatars.githubusercontent.com/u/12461822?v=3","gravatar_id":"","url":"https://api.github.com/users/lemonsweets","html_url":"https://github.com/lemonsweets","followers_url":"https://api.github.com/users/lemonsweets/followers","following_url":"https://api.github.com/users/lemonsweets/following{/other_user}","gists_url":"https://api.github.com/users/lemonsweets/gists{/gist_id}","starred_url":"https://api.github.com/users/lemonsweets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemonsweets/subscriptions","organizations_url":"https://api.github.com/users/lemonsweets/orgs","repos_url":"https://api.github.com/users/lemonsweets/repos","events_url":"https://api.github.com/users/lemonsweets/events{/privacy}","received_events_url":"https://api.github.com/users/lemonsweets/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-14T16:51:33Z","updated_at":"2015-08-14T16:51:33Z","closed_at":null,"body":"That last issue where you made the fare depend on zone was quite interesting, wasn't it? It was big but you've done half of the work required to close the current milestone.\n\nSo far, when calculating fares, you assumed that no incomplete journeys happen. Let's make it more realistic and charge a flat £5 penalty fare for any incomplete journey.\n\nIn order to close this issue, use one of the methods from the Enumerable module on an instance of an Array. Research the link between Enumerable and Array, look into what methods Enumerable provides and discuss how they could be useful with your pairing partner.\n\nYou will need to write a block to close this issue. You used blocks before without realising it. Now take time to understand what Ruby blocks are and how they work: it's one of the most fundamental constructs of Ruby, so it's critically important you're very familiar with them.\n\nUpdate your tests and code to add support for the penalty fare.\n\n## Skills you will learn:\n- S190: Use RSpec to check that code changes a variable\n- S220: Use modules\n- S253: Use 'extract method' refactoring pattern\n- S260: Use Enumerable module methods\n- S261: Modify existing methods' behaviour using blocks\n- S221: Use OpenStruct\n\n## Interview questions you may expect:\n- I216: What is refactoring? When do you refactor code?\n- I225: What are Ruby modules? How are they different from classes? When would you use a module?\n- I265: What are Ruby blocks? What's the difference between curly braces and `do...end` syntax? What happens when a block is passed to a method? How do you pass information into the block?\n- I266: Sometimes developers refer to invoking a method as \"sending a message\". Why is that?\n- I267: What is the Enumerable module in Ruby? What often used classes rely on it heavily? What functionality does it provide?\n\n## To complete this challenge:\n- [ ] Write a helper method to check that the journey is incomplete\n- [ ] Use the method `Enumerable#any?` to check if the list of stations includes an `UNKNOWN` station\n- [ ] Add an extra method `unknown?` to the `UNKNOWN` station object that will return true\n- [ ] Write a test that will simulate getting a penalty fare and make it pass\n- [ ] Ensure all methods are three lines or shorter\n\n## Suggested resources: \n- [Enumerable on RubyDoc](http://ruby-doc.org/core-2.2.2/Enumerable.html)\n- [Enumerable on The Bastards Book of Ruby](http://ruby.bastardsbook.com/chapters/enumerables/)\n- [Ruby blocks on RubyLearning](http://rubylearning.com/satishtalim/ruby_blocks.html)"}}