{"id":344,"date":"2021-02-04T14:42:00","date_gmt":"2021-02-04T14:42:00","guid":{"rendered":"https:\/\/www.simplybusiness.co.uk\/ruby-hashes-fibonacci\/"},"modified":"2024-05-30T12:08:48","modified_gmt":"2024-05-30T12:08:48","slug":"ruby-hashes-fibonacci","status":"publish","type":"post","link":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci","title":{"rendered":"Fibonacci in Ruby Hashes"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Let&#8217;s talk Hashes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A Hash is a performant key-value pair store. Performant is important here, as it means that no matter how large the Hash gets, it&#8217;s still just as quick to find a value.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are a couple of ways of defining a Hash in Ruby:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">Define the Hash with its key value pairs.<\/li>\n\n\n\n<li class=\"wp-block-list-item\">Instantiate an empty Hash. You can pass in a default value to the Hash when you instantiate it. We will come back to that.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-white-color has-dark-800-background-color has-text-color has-background has-link-color wp-elements-65a49ddf391ab04ce55929140adc7e50\" style=\"border-radius:8px;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)\"><code>menu = { pizza: 7.99 }\n# =&amp;gt; {:pizza=&amp;gt;7.99}\n\nmenu = Hash.new()\n# =&amp;gt; {}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">There are a few ways to get data from the Hash. You can use the <code>fetch<\/code> method. This returns a value for the given key. If the key isn&#8217;t found it will raise an error. You can also access the data by using the key; it will return a value if it exists, or will return a default value if it does not. The default value is <code>nil<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-dark-800-background-color has-text-color has-background has-link-color wp-elements-cf1e8281339563d511e27fc0b259b4ac\" style=\"border-radius:8px;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)\"><code>menu.fetch(:pasta)\n# KeyError (key not found: :pasta)\n\nmenu&#091;:pasta]\n# =&gt; nil<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can set a default value in two ways: either by using the <code>.default<\/code> method or by passing in a value when it&#8217;s initialised.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-dark-800-background-color has-text-color has-background has-link-color wp-elements-6a19496bf18adf88eb24f04c1ffc50df\" style=\"border-radius:8px;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)\"><code># Setting the default value using the .default method\nmenu.default\n# =&gt; nil\nmenu.default = 4.99\n# =&gt; 4.99\nmenu&#091;:salad]\n# =&gt; 4.99\n\n# Setting the default value on initialisation\nmenu= Hash.new(5)\n# =&gt; {}\nmenu&#091;:salad]\n# =&gt; 5<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can also set the default to be a <code>proc<\/code>. For example, you could create a proc so that, if you look for a key and it doesn&#8217;t exist, the key is created with a default value.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-dark-800-background-color has-text-color has-background has-link-color wp-elements-c24d904d04e82a761c7d53f1401c6029\" style=\"border-radius:8px;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)\"><code>menu = Hash.new { |menu,item| menu&#091;item] = 4.99 }\n# =&gt; {}\nmenu&#091;:ice_cream]\n# =&gt; 4.99\nmenu\n# =&gt; {:ice_cream=&gt;4.99}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.tech.sb\/\" target=\"_blank\" rel=\"noreferrer noopener\" rel=\"noopener noreferrer\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"256\" src=\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/sb-tech-site-technology.webp?w=768\" alt=\"sb-tech-site-technology\" class=\"wp-image-9605\" srcset=\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/sb-tech-site-technology.webp 768w, https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/sb-tech-site-technology.webp?resize=150,50 150w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Let\u2019s talk Fibonacci<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><em>0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/en.wikipedia.org\/wiki\/Fibonacci_sequence\" rel=\"noopener noreferrer\" target=\"_blank\">Fibonacci sequence<\/a> is a series of numbers, where the next number in the series is calculated by adding up the two numbers before it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Mathematically, the Fibonacci formula is written like this:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"173\" height=\"50\" src=\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2021\/02\/fibonacci-formula.webp?w=173\" alt=\"Fibonacci formula\" class=\"wp-image-12431\" srcset=\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2021\/02\/fibonacci-formula.webp 173w, https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2021\/02\/fibonacci-formula.webp?resize=150,43 150w\" sizes=\"auto, (max-width: 173px) 100vw, 173px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A common starter project for people learning to code is to try and write a program that calculates the Fibonacci sequence.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One possible way of calculating the Fibonacci sequence is to use code similar to that shown in Example 1.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example 1: Using a function<\/h3>\n\n\n\n<pre class=\"wp-block-code has-white-color has-dark-800-background-color has-text-color has-background has-link-color wp-elements-c5f5c1e1e2c5d85879d056671988256d\" style=\"border-radius:8px;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)\"><code>def fib(n)\n  case n\n  when 0, 1\n    n\n  else\n    fib(n-1) + fib(n-2)\n  end\nend<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This code works, and is very readable. It essentially describes exactly what it&#8217;s doing and looks very similar to the mathematical formula. But it has one key flaw. At larger numbers, the computation takes a long time. For each number in the sequence, the function needs to calculate the value -1 and the value -2 and continue to drill down until it reaches 1 or 0. This results in duplication of some of the work that it&#8217;s doing.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"392\" height=\"200\" src=\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2021\/02\/example1-calculation.webp?w=392\" alt=\"Example 1 calculation using a function\" class=\"wp-image-12434\" srcset=\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2021\/02\/example1-calculation.webp 392w, https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2021\/02\/example1-calculation.webp?resize=150,77 150w\" sizes=\"auto, (max-width: 392px) 100vw, 392px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Example 2: Using a Hash<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now let&#8217;s look at how we can calculate the Fibonacci sequence by using a Hash.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-dark-800-background-color has-text-color has-background has-link-color wp-elements-a3d46b1d452ff68b025a37626b1a5963\" style=\"border-radius:8px;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)\"><code>hash = Hash.new { |h,k|\n  h&#091;k] = h&#091;k-2] + h&#091;k-1]\n}\nhash&#091;0] = 0\nhash&#091;1] = 1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This code reads in a very similar way to the function example, but the difference is that it comes with caching. This is a form of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Memoization#:~:text=In%20computing%2C%20memoization%20or%20memoisation,the%20same%20inputs%20occur%20again.\" target=\"_blank\" rel=\"noreferrer noopener\" rel=\"noopener noreferrer\" target=\"_blank\">memoisation<\/a>. The Hash will look for the specified number; if it doesn&#8217;t exist, the number will be calculated by using the two numbers that come before it. If those numbers also don\u2019t exist, the Hash will keep running down the chain until it reaches the 0 and the 1.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"488\" height=\"200\" src=\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2021\/02\/example2-calculation.webp?w=488\" alt=\"Example 2 calculation using a Hash\" class=\"wp-image-12436\" srcset=\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2021\/02\/example2-calculation.webp 488w, https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2021\/02\/example2-calculation.webp?resize=150,61 150w\" sizes=\"auto, (max-width: 488px) 100vw, 488px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The code in Example 2 doesn&#8217;t need to calculate values in multiple branches, as it does in Example 1, because the data is already cached at the time the value was first calculated. The second time around, it just needs to read that data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To test out the differences in performance between these two calculations, I ran each block of code on my machine.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">The code in Example 1 (using a function), calculated the first 35 Fibonacci numbers in a second. The calculation required 29,860,703 calls to the function.<\/li>\n\n\n\n<li class=\"wp-block-list-item\">The Hash version in Example 2 calculated approximately 100,000 Fibonacci numbers in a second. The calculation required 69 calls to calculate 100,000 Fibonacci numbers.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I hope this helps to demonstrate the power of caching in code and sparks some thoughts of new and interesting ways that you can use Hashes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Inspired by The Humble Hash talk, by <a href=\"https:\/\/www.linkedin.com\/in\/ariel-caplan\/?originalSubdomain=il\" target=\"_blank\" rel=\"noreferrer noopener\" rel=\"noopener noreferrer\" target=\"_blank\">Ariel Caplan<\/a> at RubyConf 2020.<\/p>\n\n\n\n<div id=\"nba-upsell-001\" class=\"wp-block-group has-azure-200-background-color has-background has-global-padding is-layout-constrained wp-container-core-group-is-layout-94e519ba wp-block-group-is-layout-constrained\" style=\"padding-top:var(--wp--preset--spacing--80);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--40)\">\n<h3 class=\"wp-block-heading has-text-align-center\">See our latest technology team opportunities<\/h3>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\">If you see a position that suits, why not apply today?<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-a89b3969 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-font-size has-medium-font-size\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/www.simplybusiness.co.uk\/about-us\/careers\/tech\/\" style=\"padding-top:var(--wp--preset--spacing--20);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--20);padding-left:var(--wp--preset--spacing--30)\">Find out more<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-group has-azure-800-color has-azure-200-background-color has-text-color has-background has-link-color wp-elements-16ad430fbd6dcb711cba2ddbae941221 has-global-padding is-layout-constrained wp-container-core-group-is-layout-80fb368b wp-block-group-is-layout-constrained\" style=\"border-radius:8px;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)\">\n<p class=\"has-xxs-font-size wp-block-paragraph\">We create this content for general information purposes and it should not be taken as advice. Always take professional advice.<a href=\"https:\/\/www.simplybusiness.co.uk\/legal\/knowledge-centre-disclaimer\/\"> Read our full disclaimer<\/a><\/p>\n<\/div>\n\n\n\n<div id=\"newsletter-subscribe\" class=\"wp-block-group newsletter-subscribe is-layout-flow wp-block-group-is-layout-flow wp-block-block\" style=\"border-top-color:#cccccc;border-top-width:1px;padding-top:var(--wp--preset--spacing--80);padding-right:0;padding-bottom:var(--wp--preset--spacing--80);padding-left:0\">\n<p class=\"has-text-align-center has-dark-800-color has-text-color has-link-color has-medium-font-size wp-elements-ced002c3d2e03fde51d8880b5da0f3bb wp-block-paragraph\" style=\"margin-bottom:var(--wp--preset--spacing--50)\">A free monthly newsletter with the latest news and tools for small businesses and landlords.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-222c5d1d wp-block-buttons-is-layout-flex\" style=\"margin-bottom:var(--wp--preset--spacing--50)\">\n<div class=\"wp-block-button is-style-outline has-size-medium is-style-outline--1\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/www.simplybusiness.co.uk\/about-us\/newsletter-signup\/\">Subscribe to our newsletter<\/a><\/div>\n<\/div>\n\n\n\n<ul class=\"wp-block-social-links has-small-icon-size is-style-logos-only is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-a89b3969 wp-block-social-links-is-layout-flex\"><li class=\"wp-social-link wp-social-link-facebook  wp-block-social-link\"><a rel=\"noopener nofollow\" target=\"_blank\" href=\"https:\/\/www.facebook.com\/simplybusiness\" class=\"wp-block-social-link-anchor\" rel=\"noopener noreferrer\" target=\"_blank\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z\"><\/path><\/svg><span class=\"wp-block-social-link-label screen-reader-text\">Follow Simply Business on Facebook<\/span><\/a><\/li>\n\n<li class=\"wp-social-link wp-social-link-x  wp-block-social-link\"><a rel=\"noopener nofollow\" target=\"_blank\" href=\"https:\/\/www.x.com\/simplybusiness\" class=\"wp-block-social-link-anchor\" rel=\"noopener noreferrer\" target=\"_blank\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z\" \/><\/svg><span class=\"wp-block-social-link-label screen-reader-text\">Follow Simply Business on X<\/span><\/a><\/li>\n\n<li class=\"wp-social-link wp-social-link-youtube  wp-block-social-link\"><a rel=\"noopener nofollow\" target=\"_blank\" href=\"https:\/\/www.youtube.com\/user\/simplybusiness\" class=\"wp-block-social-link-anchor\" rel=\"noopener noreferrer\" target=\"_blank\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z\"><\/path><\/svg><span class=\"wp-block-social-link-label screen-reader-text\">Subscribe to Simply Business Videos on Youtube<\/span><\/a><\/li>\n\n<li class=\"wp-social-link wp-social-link-linkedin  wp-block-social-link\"><a rel=\"noopener nofollow\" target=\"_blank\" href=\"https:\/\/www.linkedin.com\/company\/simply-business_39914\" class=\"wp-block-social-link-anchor\" rel=\"noopener noreferrer\" target=\"_blank\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z\"><\/path><\/svg><span class=\"wp-block-social-link-label screen-reader-text\">Follow Simply Business on LinkedIn<\/span><\/a><\/li>\n\n<li class=\"wp-social-link wp-social-link-instagram  wp-block-social-link\"><a rel=\"noopener nofollow\" target=\"_blank\" href=\"https:\/\/www.instagram.com\/simplybusiness\" class=\"wp-block-social-link-anchor\" rel=\"noopener noreferrer\" target=\"_blank\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M12,4.622c2.403,0,2.688,0.009,3.637,0.052c0.877,0.04,1.354,0.187,1.671,0.31c0.42,0.163,0.72,0.358,1.035,0.673 c0.315,0.315,0.51,0.615,0.673,1.035c0.123,0.317,0.27,0.794,0.31,1.671c0.043,0.949,0.052,1.234,0.052,3.637 s-0.009,2.688-0.052,3.637c-0.04,0.877-0.187,1.354-0.31,1.671c-0.163,0.42-0.358,0.72-0.673,1.035 c-0.315,0.315-0.615,0.51-1.035,0.673c-0.317,0.123-0.794,0.27-1.671,0.31c-0.949,0.043-1.233,0.052-3.637,0.052 s-2.688-0.009-3.637-0.052c-0.877-0.04-1.354-0.187-1.671-0.31c-0.42-0.163-0.72-0.358-1.035-0.673 c-0.315-0.315-0.51-0.615-0.673-1.035c-0.123-0.317-0.27-0.794-0.31-1.671C4.631,14.688,4.622,14.403,4.622,12 s0.009-2.688,0.052-3.637c0.04-0.877,0.187-1.354,0.31-1.671c0.163-0.42,0.358-0.72,0.673-1.035 c0.315-0.315,0.615-0.51,1.035-0.673c0.317-0.123,0.794-0.27,1.671-0.31C9.312,4.631,9.597,4.622,12,4.622 M12,3 C9.556,3,9.249,3.01,8.289,3.054C7.331,3.098,6.677,3.25,6.105,3.472C5.513,3.702,5.011,4.01,4.511,4.511 c-0.5,0.5-0.808,1.002-1.038,1.594C3.25,6.677,3.098,7.331,3.054,8.289C3.01,9.249,3,9.556,3,12c0,2.444,0.01,2.751,0.054,3.711 c0.044,0.958,0.196,1.612,0.418,2.185c0.23,0.592,0.538,1.094,1.038,1.594c0.5,0.5,1.002,0.808,1.594,1.038 c0.572,0.222,1.227,0.375,2.185,0.418C9.249,20.99,9.556,21,12,21s2.751-0.01,3.711-0.054c0.958-0.044,1.612-0.196,2.185-0.418 c0.592-0.23,1.094-0.538,1.594-1.038c0.5-0.5,0.808-1.002,1.038-1.594c0.222-0.572,0.375-1.227,0.418-2.185 C20.99,14.751,21,14.444,21,12s-0.01-2.751-0.054-3.711c-0.044-0.958-0.196-1.612-0.418-2.185c-0.23-0.592-0.538-1.094-1.038-1.594 c-0.5-0.5-1.002-0.808-1.594-1.038c-0.572-0.222-1.227-0.375-2.185-0.418C14.751,3.01,14.444,3,12,3L12,3z M12,7.378 c-2.552,0-4.622,2.069-4.622,4.622S9.448,16.622,12,16.622s4.622-2.069,4.622-4.622S14.552,7.378,12,7.378z M12,15 c-1.657,0-3-1.343-3-3s1.343-3,3-3s3,1.343,3,3S13.657,15,12,15z M16.804,6.116c-0.596,0-1.08,0.484-1.08,1.08 s0.484,1.08,1.08,1.08c0.596,0,1.08-0.484,1.08-1.08S17.401,6.116,16.804,6.116z\"><\/path><\/svg><span class=\"wp-block-social-link-label screen-reader-text\">Follow Simply Business on Instagram<\/span><\/a><\/li>\n\n<li class=\"wp-social-link wp-social-link-tiktok  wp-block-social-link\"><a rel=\"noopener nofollow\" target=\"_blank\" href=\"https:\/\/www.tiktok.com\/@simplybusiness\" class=\"wp-block-social-link-anchor\" rel=\"noopener noreferrer\" target=\"_blank\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M16.708 0.027c1.745-0.027 3.48-0.011 5.213-0.027 0.105 2.041 0.839 4.12 2.333 5.563 1.491 1.479 3.6 2.156 5.652 2.385v5.369c-1.923-0.063-3.855-0.463-5.6-1.291-0.76-0.344-1.468-0.787-2.161-1.24-0.009 3.896 0.016 7.787-0.025 11.667-0.104 1.864-0.719 3.719-1.803 5.255-1.744 2.557-4.771 4.224-7.88 4.276-1.907 0.109-3.812-0.411-5.437-1.369-2.693-1.588-4.588-4.495-4.864-7.615-0.032-0.667-0.043-1.333-0.016-1.984 0.24-2.537 1.495-4.964 3.443-6.615 2.208-1.923 5.301-2.839 8.197-2.297 0.027 1.975-0.052 3.948-0.052 5.923-1.323-0.428-2.869-0.308-4.025 0.495-0.844 0.547-1.485 1.385-1.819 2.333-0.276 0.676-0.197 1.427-0.181 2.145 0.317 2.188 2.421 4.027 4.667 3.828 1.489-0.016 2.916-0.88 3.692-2.145 0.251-0.443 0.532-0.896 0.547-1.417 0.131-2.385 0.079-4.76 0.095-7.145 0.011-5.375-0.016-10.735 0.025-16.093z\" \/><\/svg><span class=\"wp-block-social-link-label screen-reader-text\">Follow Simply Business on TikTok<\/span><\/a><\/li><\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s talk Hashes A Hash is a performant key-value pair store. Performant is important here, as it means that no matter how large the Hash gets, it&#8217;s still just as quick to find a value. There are a couple of ways of defining a Hash in Ruby: There are a few ways to get data [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sb_hreflang":"","sb_hreflang_url":"","disable_breadcrumbs":false,"sb_breadcrumbs":[],"footnotes":""},"tags":[],"hidden-category":[],"coauthors":[270],"class_list":["post-344","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Fibonacci in Ruby Hashes<\/title>\n<meta name=\"description\" content=\"A demonstration of how Ruby Hashes and memoisation can be combined to improve performance, using Fibonacci calculation as an example.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Fibonacci in Ruby Hashes\" \/>\n<meta property=\"og:description\" content=\"A demonstration of how Ruby Hashes and memoisation can be combined to improve performance, using Fibonacci calculation as an example\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/\" \/>\n<meta property=\"og:site_name\" content=\"Simply Business UK\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/simplybusiness\" \/>\n<meta property=\"article:published_time\" content=\"2021-02-04T14:42:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-30T12:08:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/06\/ruby-hashes.jpg\" \/>\n<meta name=\"author\" content=\"Kelvin Samuel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@simplybusiness\" \/>\n<meta name=\"twitter:site\" content=\"@simplybusiness\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kelvin Samuel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/\"},\"author\":{\"@type\":\"Person\",\"name\":\"Kelvin Samuel\",\"description\":\"\"},\"headline\":\"Fibonacci in Ruby Hashes\",\"datePublished\":\"2021-02-04T14:42:00+00:00\",\"dateModified\":\"2024-05-30T12:08:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/\"},\"wordCount\":653,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.simplybusiness.co.uk\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/sb-tech-site-technology.webp?w=768\",\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/\",\"url\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/\",\"name\":\"Fibonacci in Ruby Hashes\",\"isPartOf\":{\"@id\":\"https:\/\/www.simplybusiness.co.uk\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/sb-tech-site-technology.webp?w=768\",\"datePublished\":\"2021-02-04T14:42:00+00:00\",\"dateModified\":\"2024-05-30T12:08:48+00:00\",\"description\":\"A demonstration of how Ruby Hashes and memoisation can be combined to improve performance, using Fibonacci calculation as an example.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#primaryimage\",\"url\":\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/sb-tech-site-technology.webp\",\"contentUrl\":\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/sb-tech-site-technology.webp\",\"width\":768,\"height\":256,\"caption\":\"sb-tech-site-technology\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.simplybusiness.co.uk\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Fibonacci in Ruby Hashes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.simplybusiness.co.uk\/#website\",\"url\":\"https:\/\/www.simplybusiness.co.uk\/\",\"name\":\"Simply Business UK\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.simplybusiness.co.uk\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.simplybusiness.co.uk\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.simplybusiness.co.uk\/#\/schema\/person\/77f91625e7ec1b88a7fca8910ce6c69f\",\"name\":\"rishvashah\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.simplybusiness.co.uk\/wp-content\/themes\/simply-business\/dist\/images\/default-author-avatar.webp9df6147f02078f0218660330fdfbacf3\",\"url\":\"https:\/\/www.simplybusiness.co.uk\/wp-content\/themes\/simply-business\/dist\/images\/default-author-avatar.webp\",\"contentUrl\":\"https:\/\/www.simplybusiness.co.uk\/wp-content\/themes\/simply-business\/dist\/images\/default-author-avatar.webp\",\"caption\":\"rishvashah\"}},{\"@type\":\"PostalAddress\",\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#local-main-place-address\",\"streetAddress\":\"Hylo, 105 Bunhill Row\",\"addressLocality\":\"London\",\"postalCode\":\"EC1Y 8LZ\",\"addressCountry\":\"GB\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#local-main-organization-logo\",\"url\":\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/logo.png\",\"contentUrl\":\"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/logo.png\",\"width\":533,\"height\":187,\"caption\":\"Simply Business UK\"}]}<\/script>\n<meta name=\"geo.placename\" content=\"London\" \/>\n<meta name=\"geo.region\" content=\"United Kingdom (UK)\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Fibonacci in Ruby Hashes","description":"A demonstration of how Ruby Hashes and memoisation can be combined to improve performance, using Fibonacci calculation as an example.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/","og_locale":"en_GB","og_type":"article","og_title":"Fibonacci in Ruby Hashes","og_description":"A demonstration of how Ruby Hashes and memoisation can be combined to improve performance, using Fibonacci calculation as an example","og_url":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/","og_site_name":"Simply Business UK","article_publisher":"https:\/\/www.facebook.com\/simplybusiness","article_published_time":"2021-02-04T14:42:00+00:00","article_modified_time":"2024-05-30T12:08:48+00:00","og_image":[{"url":"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/06\/ruby-hashes.jpg","type":"","width":"","height":""}],"author":"Kelvin Samuel","twitter_card":"summary_large_image","twitter_creator":"@simplybusiness","twitter_site":"@simplybusiness","twitter_misc":{"Written by":"Kelvin Samuel","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#article","isPartOf":{"@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/"},"author":{"@type":"Person","name":"Kelvin Samuel","description":""},"headline":"Fibonacci in Ruby Hashes","datePublished":"2021-02-04T14:42:00+00:00","dateModified":"2024-05-30T12:08:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/"},"wordCount":653,"commentCount":0,"publisher":{"@id":"https:\/\/www.simplybusiness.co.uk\/#organization"},"image":{"@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#primaryimage"},"thumbnailUrl":"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/sb-tech-site-technology.webp?w=768","inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/","url":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/","name":"Fibonacci in Ruby Hashes","isPartOf":{"@id":"https:\/\/www.simplybusiness.co.uk\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#primaryimage"},"image":{"@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#primaryimage"},"thumbnailUrl":"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/sb-tech-site-technology.webp?w=768","datePublished":"2021-02-04T14:42:00+00:00","dateModified":"2024-05-30T12:08:48+00:00","description":"A demonstration of how Ruby Hashes and memoisation can be combined to improve performance, using Fibonacci calculation as an example.","breadcrumb":{"@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#primaryimage","url":"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/sb-tech-site-technology.webp","contentUrl":"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/sb-tech-site-technology.webp","width":768,"height":256,"caption":"sb-tech-site-technology"},{"@type":"BreadcrumbList","@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.simplybusiness.co.uk\/"},{"@type":"ListItem","position":2,"name":"Fibonacci in Ruby Hashes"}]},{"@type":"WebSite","@id":"https:\/\/www.simplybusiness.co.uk\/#website","url":"https:\/\/www.simplybusiness.co.uk\/","name":"Simply Business UK","description":"","publisher":{"@id":"https:\/\/www.simplybusiness.co.uk\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.simplybusiness.co.uk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.simplybusiness.co.uk\/#\/schema\/person\/77f91625e7ec1b88a7fca8910ce6c69f","name":"rishvashah","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.simplybusiness.co.uk\/wp-content\/themes\/simply-business\/dist\/images\/default-author-avatar.webp9df6147f02078f0218660330fdfbacf3","url":"https:\/\/www.simplybusiness.co.uk\/wp-content\/themes\/simply-business\/dist\/images\/default-author-avatar.webp","contentUrl":"https:\/\/www.simplybusiness.co.uk\/wp-content\/themes\/simply-business\/dist\/images\/default-author-avatar.webp","caption":"rishvashah"}},{"@type":"PostalAddress","@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#local-main-place-address","streetAddress":"Hylo, 105 Bunhill Row","addressLocality":"London","postalCode":"EC1Y 8LZ","addressCountry":"GB"},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci\/#local-main-organization-logo","url":"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/logo.png","contentUrl":"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/05\/logo.png","width":533,"height":187,"caption":"Simply Business UK"}]},"geo.placename":"London","geo.region":"United Kingdom (UK)"},"parsely":{"version":"1.1.0","canonical_url":"https:\/\/simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci","smart_links":{"inbound":0,"outbound":0},"traffic_boost_suggestions_count":0,"meta":{"@context":"https:\/\/schema.org","@type":"NewsArticle","headline":"Fibonacci in Ruby Hashes","url":"http:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci","mainEntityOfPage":{"@type":"WebPage","@id":"http:\/\/www.simplybusiness.co.uk\/about-us\/tech\/2021\/02\/ruby-hashes-fibonacci"},"thumbnailUrl":"","image":{"@type":"ImageObject","url":""},"articleSection":"Uncategorised","author":[{"@type":"Person","name":"Kelvin Samuel"}],"creator":["Kelvin Samuel"],"publisher":{"@type":"Organization","name":"Simply Business UK","logo":"https:\/\/www.simplybusiness.co.uk\/wp-content\/uploads\/sites\/3\/2024\/04\/icon-512x512-1.png"},"keywords":[],"dateCreated":"2021-02-04T14:42:00Z","datePublished":"2021-02-04T14:42:00Z","dateModified":"2024-05-30T12:08:48Z"},"rendered":"<script type=\"application\/ld+json\" class=\"wp-parsely-metadata\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@type\":\"NewsArticle\",\"headline\":\"Fibonacci in Ruby Hashes\",\"url\":\"http:\\\/\\\/www.simplybusiness.co.uk\\\/about-us\\\/tech\\\/2021\\\/02\\\/ruby-hashes-fibonacci\",\"mainEntityOfPage\":{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/www.simplybusiness.co.uk\\\/about-us\\\/tech\\\/2021\\\/02\\\/ruby-hashes-fibonacci\"},\"thumbnailUrl\":\"\",\"image\":{\"@type\":\"ImageObject\",\"url\":\"\"},\"articleSection\":\"Uncategorised\",\"author\":[{\"@type\":\"Person\",\"name\":\"Kelvin Samuel\"}],\"creator\":[\"Kelvin Samuel\"],\"publisher\":{\"@type\":\"Organization\",\"name\":\"Simply Business UK\",\"logo\":\"https:\\\/\\\/www.simplybusiness.co.uk\\\/wp-content\\\/uploads\\\/sites\\\/3\\\/2024\\\/04\\\/icon-512x512-1.png\"},\"keywords\":[],\"dateCreated\":\"2021-02-04T14:42:00Z\",\"datePublished\":\"2021-02-04T14:42:00Z\",\"dateModified\":\"2024-05-30T12:08:48Z\"}<\/script>","tracker_url":"https:\/\/cdn.parsely.com\/keys\/simplybusiness.co.uk\/p.js"},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.simplybusiness.co.uk\/wp-json\/wp\/v2\/posts\/344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.simplybusiness.co.uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.simplybusiness.co.uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.simplybusiness.co.uk\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/www.simplybusiness.co.uk\/wp-json\/wp\/v2\/comments?post=344"}],"version-history":[{"count":18,"href":"https:\/\/www.simplybusiness.co.uk\/wp-json\/wp\/v2\/posts\/344\/revisions"}],"predecessor-version":[{"id":13956,"href":"https:\/\/www.simplybusiness.co.uk\/wp-json\/wp\/v2\/posts\/344\/revisions\/13956"}],"wp:attachment":[{"href":"https:\/\/www.simplybusiness.co.uk\/wp-json\/wp\/v2\/media?parent=344"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.simplybusiness.co.uk\/wp-json\/wp\/v2\/tags?post=344"},{"taxonomy":"hidden-category","embeddable":true,"href":"https:\/\/www.simplybusiness.co.uk\/wp-json\/wp\/v2\/hidden-category?post=344"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.simplybusiness.co.uk\/wp-json\/wp\/v2\/coauthors?post=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}