{"id":40839,"date":"2026-01-06T14:24:44","date_gmt":"2026-01-06T14:24:44","guid":{"rendered":"https:\/\/www.railscarma.com\/?p=40839"},"modified":"2026-01-06T14:24:47","modified_gmt":"2026-01-06T14:24:47","slug":"hur-man-laser-och-skriver-filer-i-ruby-med-exempel","status":"publish","type":"post","link":"https:\/\/www.railscarma.com\/sv\/blogg\/hur-man-laser-och-skriver-filer-i-ruby-med-exempel\/","title":{"rendered":"Hur man l\u00e4ser och skriver filer i Ruby (med exempel)"},"content":{"rendered":"<div data-elementor-type=\"wp-post\" data-elementor-id=\"40839\" class=\"elementor elementor-40839\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-fb4f7f3 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"fb4f7f3\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-96e3d48\" data-id=\"96e3d48\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-3d3c3ad elementor-widget elementor-widget-text-editor\" data-id=\"3d3c3ad\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Ruby erbjuder enkla, eleganta och kraftfulla s\u00e4tt att l\u00e4sa fr\u00e5n och skriva till filer. Spr\u00e5ket l\u00e4gger stor vikt vid l\u00e4sbarhet och utvecklarv\u00e4nlighet, vilket g\u00f6r fil-I\/O-operationer enkla och smidiga. Den h\u00e4r guiden behandlar de vanligaste och mest typiska metoderna med praktiska exempel.<\/p><h3><strong>Grundl\u00e4ggande begrepp<\/strong><\/h3><p>I Ruby utf\u00f6rs filhantering vanligtvis med hj\u00e4lp av <code>Fil<\/code> klassen eller den kortare <code>File.open<\/code> metod. De flesta fil\u00e5tg\u00e4rder anv\u00e4nder <strong>block<\/strong> f\u00f6r att s\u00e4kerst\u00e4lla att filer st\u00e4ngs ordentligt efter anv\u00e4ndning, vilket f\u00f6rhindrar resursl\u00e4ckor.<\/p><h3><strong>\u00d6ppna en fil<\/strong><\/h3><p>Det rekommenderade s\u00e4ttet \u00e4r att anv\u00e4nda ett blockformul\u00e4r:<\/p><pre>ruby\nFile.open(\"filnamn.txt\", \"r\") do |fil|\n  <em># arbetar med filen<\/em>\nslutet\n<em>#-filen st\u00e4ngs automatiskt h\u00e4r<\/em><\/pre><p>Om det inte finns n\u00e5got block m\u00e5ste du st\u00e4nga filen manuellt:<\/p><pre>ruby\nfile = File.open(\"filename.txt\", \"r\")\n<em># ... drift ...<\/em>\nfile.close<\/pre><h3><strong>Fill\u00e4gen<\/strong><\/h3><p>Det andra argumentet till <code>File.open<\/code> \u00e4r den <strong>l\u00e4ge<\/strong> str\u00e4ng:<\/p><table width=\"624\"><tbody><tr><td width=\"102\"><strong>L\u00e4ge<\/strong><\/td><td width=\"522\"><strong>Betydelse<\/strong><\/td><\/tr><tr><td width=\"102\">\u201cr\u201d<\/td><td width=\"522\">Skrivskyddad (standard)<\/td><\/tr><tr><td width=\"102\">\u201cw\u201d<\/td><td width=\"522\">Endast skriv\u00e5tkomst, skapar\/trunkerar filen<\/td><\/tr><tr><td width=\"102\">\u201ca\u201d<\/td><td width=\"522\">Skrivskyddad, l\u00e4gger till data i filen<\/td><\/tr><tr><td width=\"102\">\u201cr+\u201d<\/td><td width=\"522\">L\u00e4ser och skriver, bevarar inneh\u00e5llet<\/td><\/tr><tr><td width=\"102\">\u201cw+\u201d<\/td><td width=\"522\">L\u00e4ser och skriver, trunkerar filen<\/td><\/tr><tr><td width=\"102\">\u201ca+\u201d<\/td><td width=\"522\">L\u00e4s och skriv, l\u00e4gg till<\/td><\/tr><\/tbody><\/table><p>L\u00e4gg till \u201cb\u201d f\u00f6r bin\u00e4rt l\u00e4ge i Windows (t.ex. \u201crb\u201d, \u201cwb\u201d).<\/p><h3><strong>L\u00e4sa in filer i Ruby<\/strong><\/h3><p><strong>1. L\u00e4s hela filen som en str\u00e4ng<\/strong><\/p><pre>ruby\ncontent = File.read(\"example.txt\")\nputs content<\/pre><p>Eller genom att anv\u00e4nda <code>File.open<\/code>:<\/p><pre>ruby\ncontent = File.open(\"example.txt\", \"r\") { |f| f.read }<\/pre><p><strong>2. L\u00e4s in hela filen i en array med rader<\/strong><\/p><pre>ruby\nlines = File.readlines(\"example.txt\")\nlines.each { |line| puts line }\n\n<em># Eller mer idiomatiskt uttryckt:<\/em>\nFile.readlines(\"example.txt\").each do |line|\n  puts \"Rad: #{line.chomp}\"\nend<\/pre><p><strong>3.<\/strong> <strong>L\u00e4s rad f\u00f6r rad (mest minneseffektivt)<\/strong><\/p><p>Perfekt f\u00f6r stora filer:<\/p><pre>ruby\nFile.open(\"large_file.txt\", \"r\") do |file|\n  file.each_line do |line|\n    puts line.chomp.upcase\n  end\nend<\/pre><p>Eller genom att anv\u00e4nda den kortare <code>foreach<\/code>:<\/p><pre>ruby\nFile.foreach(\"large_file.txt\") do |line|\n  process(line.chomp)\nend<\/pre><p><strong>4. L\u00e4s ett visst antal byte eller rader<\/strong><\/p><pre>ruby\nFile.open(\"data.bin\", \"rb\") do |f|\n  header = f.read(16)\u00a0\u00a0\u00a0\u00a0\u00a0 <em># l\u00e4ser de f\u00f6rsta 16 byten<\/em>\n  s\u00e4tter rubrik\nslut\n\n<em># L\u00e4s de f\u00f6rsta 5 raderna<\/em>\nfirst_five = File.foreach(\"log.txt\").first(5)<\/pre><p><strong>5. L\u00e4s med angiven kodning<\/strong><\/p><pre>ruby\ncontent = File.read(\"utf8_file.txt\", encoding: \"UTF-8\")\n<em># eller<\/em>\nFile.open(\"file.txt\", \"r:UTF-8\") do |f|\n  f.each_line { |line| puts line }\nend<\/pre><h3><strong>Skriva till filer i Ruby<\/strong><\/h3><p><strong>1. Skriva en str\u00e4ng till en fil (\u00f6verskriver)<\/strong><\/p><pre>ruby\nFile.write(\"output.txt\", \"Hej, Ruby!\\nDet h\u00e4r \u00e4r en ny fil.\")<\/pre><p>Det h\u00e4r \u00e4r det enklaste och vanligaste s\u00e4ttet.<\/p><p><strong style=\"font-size: 16px;\">2. Skriv med hj\u00e4lp av File.open (blockform)<\/strong><\/p><pre>ruby\nFile.open(\"greeting.txt\", \"w\") do |file|\n  file.puts \"Hello World\"\n  file.puts \"V\u00e4lkommen till Ruby-fil-I\/O\"\n  file.write \"Denna rad skrivs utan radbrytning\"\n  file &lt;&lt; &quot; &lt;&lt; H\u00e4r anv\u00e4nds shovel-operatorn\\n&quot;\nend<\/pre><p>Metoder som finns tillg\u00e4ngliga inom blocket:<\/p><ul><li><code>s\u00e4tter<\/code> \u2013 l\u00e4gger till en radbrytning<\/li><li><code>skriv ut<\/code> \u2013 ingen radbrytning<\/li><li><code>skriva<\/code> \u2013 ingen radbrytning (alias f\u00f6r <code>&lt;&lt;<\/code>)<\/li><li><code>&lt;&lt;<\/code> \u2013 gr\u00e4vmaskinist<\/li><\/ul><p><strong style=\"font-size: 16px;\">3. L\u00e4gg till i en fil<\/strong><\/p><pre>ruby\nFile.open(\"log.txt\", \"a\") do |file|\n  file.puts \"#{Time.now}: Programmet startades\"\nend\n\n<em># Eller kortare:<\/em>\nFile.write(\"log.txt\", \"Ny loggpost\\n\", mode: \"a\")<\/pre><p><strong style=\"font-size: 16px;\">4. Skriv en radmatris<\/strong><\/p><pre>ruby\nlines = [\"F\u00f6rsta raden\", \"Andra raden\", \"Tredje raden\"]\n\nFile.open(\"lines.txt\", \"w\") do |file|\n  lines.each { |line| file.puts line }\nend\n\n<em># Eller \u00e4nnu kortare:<\/em>\nFile.write(\"lines.txt\", lines.join(\"\\n\") + \"\\n\")<\/pre><h3><strong>Praktiska exempel<\/strong><\/h3><h5><strong>Exempel 1: Kopiera en fil<\/strong><\/h5><pre>ruby\ndef copy_file(k\u00e4lla, m\u00e5l)\n  File.write(m\u00e5l, File.read(k\u00e4lla))\nend\n\ncopy_file(\"k\u00e4lla.txt\", \"backup.txt\")<\/pre><p>Eller i bin\u00e4rl\u00e4ge:<\/p><pre>ruby\nFile.write(\"backup.bin\", File.read(\"original.bin\", mode: \"rb\"), mode: \"wb\")<\/pre><h5><strong>Exempel 2: Enkel CSV-skrivare<\/strong><\/h5><pre>ruby\ndata = [\n  [\"Namn\", \"\u00c5lder\", \"Stad\"],\n  [\"Alice\", 30, \"New York\"],\n  [\"Bob\", 25, \"London\"]\n]\n\nFile.open(\"people.csv\", \"w\") do |file|\n  data.each do |row|\n    file.puts row.join(\",\")\n  end\nend<\/pre><h5><strong>Exempel 3: Enkel CSV-l\u00e4sare<\/strong><\/h5><pre>ruby\nFile.foreach(\"people.csv\") do |line|\n  name, age, city = line.chomp.split(\",\")\n  puts \"#{name} \u00e4r #{age} \u00e5r gammal och bor i #{city}\"\nend<\/pre><h5><strong>Exempel 4: R\u00e4kna rader i en fil<\/strong><\/h5><pre>ruby\nline_count = File.foreach(\"large.txt\").inject(0) { |count, _| count + 1 }\nputs \"Totalt antal rader: #{line_count}\"\n\n<em># Eller enklare uttryckt (laddar in alla rader i minnet):<\/em>\nputs File.readlines(\"file.txt\").size<\/pre><h5><strong>Exempel 5: S\u00e4ker filskrivning (atomisk skrivning)<\/strong><\/h5><p>F\u00f6r att undvika att filer skadas vid ett systemkrasch ska du f\u00f6rst skriva till en tillf\u00e4llig fil:<\/p><pre>ruby\nrequire 'tempfile'\n\nTempfile.create('safe_write') do |temp_file|\n  temp_file.puts \"Viktiga data\"\n  temp_file.puts \"\u00c4nnu viktigare data\"\n  temp_file.flush\n\n  <em># Ers\u00e4tt nu m\u00e5lfilen atom\u00e4rt<\/em>\n  File.rename(temp_file.path, \"important.txt\")\nend<\/pre><h3><strong>Arbeta med v\u00e4gar<\/strong><\/h3><p>Anv\u00e4ndning <code>File.expand_path, File.join<\/code>, och <code>S\u00f6kv\u00e4g<\/code> f\u00f6r stabil hantering av s\u00f6kv\u00e4gar:<\/p><pre>ruby\nrequire 'pathname'\n\npath = Pathname.new(\"\/tmp\") \/ \"myapp\" \/ \"log.txt\"\nFile.write(path, \"Logginl\u00e4gg\")\n\n<em># Eller med hj\u00e4lp av File.join<\/em>\nfull_path = File.join(Dir.home, \"Documents\", \"notes.txt\")<\/pre><h3><strong>Felhantering<\/strong><\/h3><p>Hantera alltid eventuella fel:<\/p><pre>ruby\nbegin\n  content = File.read(\"nonexistent.txt\")\nrescue Errno::ENOENT\n  puts \"Filen hittades inte!\"\nrescue Errno::EACCES\n  puts \"\u00c5tkomst nekad!\"\nrescue =&gt; e\n  puts \"Fel: #{e.message}\"\nend<\/pre><p>Eller mer idiomatiskt uttryckt:<\/p><pre>ruby\nif File.exist?(\"config.txt\")\n  config = File.read(\"config.txt\")\nelse\n  puts \"Konfigurationsfilen saknas, standardinst\u00e4llningarna anv\u00e4nds\"\nend<\/pre><h3><strong>B\u00e4sta metoder f\u00f6r att l\u00e4sa och skriva filer i Ruby<\/strong><\/h3><ol><li><strong>Anv\u00e4nd alltid blockformat<\/strong> n\u00e4r det \u00e4r m\u00f6jligt \u2013 s\u00e4kerst\u00e4ller att filen st\u00e4ngs.<\/li><li><strong>Anv\u00e4ndning <\/strong><code>File.read<strong>\/<\/strong>File.write<\/code> f\u00f6r enkla \u00e5tg\u00e4rder som omfattar hela filer.<\/li><li><strong>Anv\u00e4ndning <\/strong><code>foreach<\/code> f\u00f6r stora filer, f\u00f6r att undvika att allt laddas in i minnet.<\/li><li><strong>Ange kodning<\/strong> n\u00e4r man arbetar med text som inte \u00e4r ASCII-kodad.<\/li><li><strong>Kontrollera om filen finns<\/strong> l\u00e4s detta f\u00f6rst om det beh\u00f6vs.<\/li><li><strong>Anv\u00e4nd l\u00e4mpliga l\u00e4gen<\/strong> (s\u00e4rskilt i bin\u00e4rl\u00e4ge i Windows).<\/li><li><strong>Hantera undantag<\/strong> p\u00e5 ett elegant s\u00e4tt i produktionskoden.<\/li><\/ol><h2><strong>Slutsats<\/strong><\/h2><p>P\u00e5 <a href=\"https:\/\/www.railscarma.com\/sv\"><strong>RailsCarma<\/strong><\/a>ett ledande <a href=\"https:\/\/www.railscarma.com\/sv\"><strong>Ruby on Rails utvecklingsf\u00f6retag<\/strong><\/a>, utnyttjar v\u00e5ra erfarna utvecklare Rubys eleganta funktioner f\u00f6r fil-I\/O f\u00f6r att leverera robusta och l\u00e4tthanterliga applikationer. Rubys tydliga syntax, blockbaserad resurshantering och kraftfulla metoder som <code>File.read<\/code> och <code>File.write<\/code> g\u00f6ra <strong>filhantering i Ruby<\/strong> s\u00e4ker, effektiv och skalbar.<\/p><p>Oavsett om det handlar om att bearbeta konfigurationsfiler, hantera loggar, skapa rapporter eller bygga komplexa datapipelines, s\u00e5 \u00e4r v\u00e5r <a href=\"https:\/\/www.railscarma.com\/sv\"><strong>R\u00e4lsutvecklingstj\u00e4nster<\/strong><\/a> s\u00e4kerst\u00e4lla s\u00e5 lite standardkod som m\u00f6jligt, maximal uttrycksfullhet och h\u00f6g prestanda. Genom att v\u00e4lja att <a href=\"https:\/\/www.railscarma.com\/sv\/hyra-ruby-on-rails-utvecklare\/\"><strong>anst\u00e4lla Ruby-utvecklare<\/strong><\/a> Genom RailsCarma f\u00e5r du tillg\u00e5ng till kompetenta utvecklare som bygger p\u00e5litliga Rails-applikationer av h\u00f6g kvalitet, skr\u00e4ddarsydda efter just dina aff\u00e4rsbehov.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t  <div class=\"related-post slider\">\r\n        <div class=\"headline\">relaterade inl\u00e4gg<\/div>\r\n    <div class=\"post-list owl-carousel\">\r\n\r\n            <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Top 20 Programming Languages in 2026: Trends, Uses, Pros, Cons &amp; How to Choose\" href=\"https:\/\/www.railscarma.com\/sv\/blogg\/top-most-popular-programming-languages\/?related_post_from=41474\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/08\/Most-Popular-Programming-Languages-in-2026.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Most Popular Programming Languages\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/08\/Most-Popular-Programming-Languages-in-2026.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/08\/Most-Popular-Programming-Languages-in-2026-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/08\/Most-Popular-Programming-Languages-in-2026-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/08\/Most-Popular-Programming-Languages-in-2026-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Top 20 Programming Languages in 2026: Trends, Uses, Pros, Cons &amp; How to Choose\" href=\"https:\/\/www.railscarma.com\/sv\/blogg\/top-most-popular-programming-languages\/?related_post_from=41474\">\r\n        Top 20 Programming Languages in 2026: Trends, Uses, Pros, Cons &amp; How to Choose  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Hur nystartade f\u00f6retag kan utveckla AI-produkter snabbare med Ruby on Rails\" href=\"https:\/\/www.railscarma.com\/sv\/blogg\/how-startups-can-build-ai-products-faster-with-ruby-on-rails\/?related_post_from=41464\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/08\/How-Startups-Can-Build-AI-Products-Faster-with-Ruby-on-Rails.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Hur nystartade f\u00f6retag kan utveckla AI-produkter snabbare med Ruby on Rails\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/08\/How-Startups-Can-Build-AI-Products-Faster-with-Ruby-on-Rails.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/08\/How-Startups-Can-Build-AI-Products-Faster-with-Ruby-on-Rails-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/08\/How-Startups-Can-Build-AI-Products-Faster-with-Ruby-on-Rails-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/08\/How-Startups-Can-Build-AI-Products-Faster-with-Ruby-on-Rails-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Hur nystartade f\u00f6retag kan utveckla AI-produkter snabbare med Ruby on Rails\" href=\"https:\/\/www.railscarma.com\/sv\/blogg\/how-startups-can-build-ai-products-faster-with-ruby-on-rails\/?related_post_from=41464\">\r\n        Hur nystartade f\u00f6retag kan utveckla AI-produkter snabbare med Ruby on Rails  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Ruby on Rails f\u00f6r automatiseringsl\u00f6sningar inom f\u00f6retagssektorn: En omvandling av den moderna aff\u00e4rsverksamheten\" href=\"https:\/\/www.railscarma.com\/sv\/blogg\/ruby-on-rails-for-automatiseringslosningar-inom-foretagssektorn\/?related_post_from=41410\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/07\/Ruby-on-Rails-for-Enterprise-Automation-Solutions.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Ruby on Rails f\u00f6r automatiseringsl\u00f6sningar inom f\u00f6retagssektorn\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/07\/Ruby-on-Rails-for-Enterprise-Automation-Solutions.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/07\/Ruby-on-Rails-for-Enterprise-Automation-Solutions-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/07\/Ruby-on-Rails-for-Enterprise-Automation-Solutions-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/07\/Ruby-on-Rails-for-Enterprise-Automation-Solutions-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Ruby on Rails f\u00f6r automatiseringsl\u00f6sningar inom f\u00f6retagssektorn: En omvandling av den moderna aff\u00e4rsverksamheten\" href=\"https:\/\/www.railscarma.com\/sv\/blogg\/ruby-on-rails-for-automatiseringslosningar-inom-foretagssektorn\/?related_post_from=41410\">\r\n        Ruby on Rails f\u00f6r automatiseringsl\u00f6sningar inom f\u00f6retagssektorn: En omvandling av den moderna aff\u00e4rsverksamheten  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"De 20 b\u00e4sta webbutvecklingsf\u00f6retagen i Indien 2026\" href=\"https:\/\/www.railscarma.com\/sv\/blogg\/top-web-development-companies-india\/?related_post_from=41420\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/07\/Top-20-Web-Development-Companies-in-India-2026.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Webbutvecklingsf\u00f6retag i Indien\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/07\/Top-20-Web-Development-Companies-in-India-2026.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/07\/Top-20-Web-Development-Companies-in-India-2026-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/07\/Top-20-Web-Development-Companies-in-India-2026-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/07\/Top-20-Web-Development-Companies-in-India-2026-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"De 20 b\u00e4sta webbutvecklingsf\u00f6retagen i Indien 2026\" href=\"https:\/\/www.railscarma.com\/sv\/blogg\/top-web-development-companies-india\/?related_post_from=41420\">\r\n        De 20 b\u00e4sta webbutvecklingsf\u00f6retagen i Indien 2026  <\/a>\r\n\r\n        <\/div>\r\n      \r\n  <\/div>\r\n\r\n  <script>\r\n      <\/script>\r\n  <style>\r\n    .related-post {}\r\n\r\n    .related-post .post-list {\r\n      text-align: left;\r\n          }\r\n\r\n    .related-post .post-list .item {\r\n      margin: 10px;\r\n      padding: 10px;\r\n          }\r\n\r\n    .related-post .headline {\r\n      font-size: 14px !important;\r\n      color: #999999 !important;\r\n          }\r\n\r\n    .related-post .post-list .item .post_thumb {\r\n      max-height: 220px;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n          }\r\n\r\n    .related-post .post-list .item .post_title {\r\n      font-size: 14px;\r\n      color: #000000;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .post-list .item .post_excerpt {\r\n      font-size: 12px;\r\n      color: #3f3f3f;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .owl-dots .owl-dot {\r\n          }\r\n\r\n      <\/style>\r\n      <script>\r\n      jQuery(document).ready(function($) {\r\n        $(\".related-post .post-list\").owlCarousel({\r\n          items: 2,\r\n          responsiveClass: true,\r\n          responsive: {\r\n            0: {\r\n              items: 1,\r\n            },\r\n            768: {\r\n              items: 2,\r\n            },\r\n            1200: {\r\n              items: 2,\r\n            }\r\n          },\r\n                      rewind: true,\r\n                                loop: true,\r\n                                center: false,\r\n                                autoplay: true,\r\n            autoplayHoverPause: true,\r\n                                nav: true,\r\n            navSpeed: 1000,\r\n            navText: ['<i class=\"fas fa-chevron-left\"><\/i>', '<i class=\"fas fa-chevron-right\"><\/i>'],\r\n                                dots: false,\r\n            dotsSpeed: 1200,\r\n                                                    rtl: false,\r\n          \r\n        });\r\n      });\r\n    <\/script>\r\n  <\/div>","protected":false},"excerpt":{"rendered":"<p>Ruby erbjuder enkla, eleganta och kraftfulla s\u00e4tt att l\u00e4sa fr\u00e5n och skriva till filer. Spr\u00e5ket l\u00e4gger stor vikt vid l\u00e4sbarhet och utvecklarv\u00e4nlighet, vilket g\u00f6r fil-I\/O-operationer enkla och \u00f6versk\u00e5dliga. Den h\u00e4r guiden behandlar de vanligaste och mest idiomatiska metoderna med praktiska exempel. Grundl\u00e4ggande begrepp I Ruby utf\u00f6rs filoperationer vanligtvis med hj\u00e4lp av klassen File eller det kortare File.open \u2026<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.railscarma.com\/sv\/blogg\/top-web-development-companies-india\/\"> <span class=\"screen-reader-text\">De 20 b\u00e4sta webbutvecklingsf\u00f6retagen i Indien 2026<\/span> L\u00e4s mer \u00bb<\/a><\/p>","protected":false},"author":11,"featured_media":40850,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1224],"tags":[],"class_list":["post-40839","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Read and Write Files in Ruby (With Examples) - RailsCarma<\/title>\n<meta name=\"description\" content=\"Learn how to read and write files in Ruby with clear examples covering File.read, File.write, blocks, and best practices.\" \/>\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.railscarma.com\/sv\/blogg\/hur-man-laser-och-skriver-filer-i-ruby-med-exempel\/\" \/>\n<meta property=\"og:locale\" content=\"sv_SE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Read and Write Files in Ruby (With Examples) - RailsCarma\" \/>\n<meta property=\"og:description\" content=\"Learn how to read and write files in Ruby with clear examples covering File.read, File.write, blocks, and best practices.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.railscarma.com\/sv\/blogg\/hur-man-laser-och-skriver-filer-i-ruby-med-exempel\/\" \/>\n<meta property=\"og:site_name\" content=\"RailsCarma - Ruby on Rails Development Company specializing in Offshore Development\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RailsCarma\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-06T14:24:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-06T14:24:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/01\/How-To-Read-and-Write-Files-in-Ruby-With-Examples.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"ashish\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@railscarma\" \/>\n<meta name=\"twitter:site\" content=\"@railscarma\" \/>\n<meta name=\"twitter:label1\" content=\"Skriven av\" \/>\n\t<meta name=\"twitter:data1\" content=\"ashish\" \/>\n\t<meta name=\"twitter:label2\" content=\"Ber\u00e4knad l\u00e4stid\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minuter\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/\"},\"author\":{\"name\":\"ashish\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/person\/9699b14852b308edfeb03096b33c7a7a\"},\"headline\":\"How To Read and Write Files in Ruby (With Examples)\",\"datePublished\":\"2026-01-06T14:24:44+00:00\",\"dateModified\":\"2026-01-06T14:24:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/\"},\"wordCount\":468,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.railscarma.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/01\/How-To-Read-and-Write-Files-in-Ruby-With-Examples.png\",\"articleSection\":[\"Blogs\"],\"inLanguage\":\"sv-SE\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/\",\"url\":\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/\",\"name\":\"How To Read and Write Files in Ruby (With Examples) - RailsCarma\",\"isPartOf\":{\"@id\":\"https:\/\/www.railscarma.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/01\/How-To-Read-and-Write-Files-in-Ruby-With-Examples.png\",\"datePublished\":\"2026-01-06T14:24:44+00:00\",\"dateModified\":\"2026-01-06T14:24:47+00:00\",\"description\":\"Learn how to read and write files in Ruby with clear examples covering File.read, File.write, blocks, and best practices.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#breadcrumb\"},\"inLanguage\":\"sv-SE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#primaryimage\",\"url\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/01\/How-To-Read-and-Write-Files-in-Ruby-With-Examples.png\",\"contentUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/01\/How-To-Read-and-Write-Files-in-Ruby-With-Examples.png\",\"width\":800,\"height\":300,\"caption\":\"Read and Write Files in Ruby\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.railscarma.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Read and Write Files in Ruby (With Examples)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.railscarma.com\/#website\",\"url\":\"https:\/\/www.railscarma.com\/\",\"name\":\"RailsCarma - Ruby on Rails Development Company specializing in Offshore Development\",\"description\":\"RailsCarma is a Ruby on Rails Development Company in Bangalore. We specialize in Offshore Ruby on Rails Development based out in USA and India. Hire experienced Ruby on Rails developers for the ultimate Web Experience.\",\"publisher\":{\"@id\":\"https:\/\/www.railscarma.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.railscarma.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"sv-SE\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.railscarma.com\/#organization\",\"name\":\"RailsCarma\",\"url\":\"https:\/\/www.railscarma.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png\",\"contentUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png\",\"width\":200,\"height\":46,\"caption\":\"RailsCarma\"},\"image\":{\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RailsCarma\/\",\"https:\/\/x.com\/railscarma\",\"https:\/\/www.linkedin.com\/company\/railscarma\/\",\"https:\/\/myspace.com\/railscarma\",\"https:\/\/in.pinterest.com\/railscarma\/\",\"https:\/\/www.youtube.com\/channel\/UCx3Wil-aAnDARuatTEyMdpg\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/person\/9699b14852b308edfeb03096b33c7a7a\",\"name\":\"ashish\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/204411c7d72714bc32d5ac6398e0596896318386bd537860fdd14ce905a79e07?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/204411c7d72714bc32d5ac6398e0596896318386bd537860fdd14ce905a79e07?s=96&d=mm&r=g\",\"caption\":\"ashish\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hur man l\u00e4ser och skriver filer i Ruby (med exempel) \u2013 RailsCarma","description":"L\u00e4r dig hur man l\u00e4ser och skriver filer i Ruby med tydliga exempel som t\u00e4cker File.read, File.write, block och b\u00e4sta praxis.","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.railscarma.com\/sv\/blogg\/hur-man-laser-och-skriver-filer-i-ruby-med-exempel\/","og_locale":"sv_SE","og_type":"article","og_title":"How To Read and Write Files in Ruby (With Examples) - RailsCarma","og_description":"Learn how to read and write files in Ruby with clear examples covering File.read, File.write, blocks, and best practices.","og_url":"https:\/\/www.railscarma.com\/sv\/blogg\/hur-man-laser-och-skriver-filer-i-ruby-med-exempel\/","og_site_name":"RailsCarma - Ruby on Rails Development Company specializing in Offshore Development","article_publisher":"https:\/\/www.facebook.com\/RailsCarma\/","article_published_time":"2026-01-06T14:24:44+00:00","article_modified_time":"2026-01-06T14:24:47+00:00","og_image":[{"width":800,"height":300,"url":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/01\/How-To-Read-and-Write-Files-in-Ruby-With-Examples.png","type":"image\/png"}],"author":"ashish","twitter_card":"summary_large_image","twitter_creator":"@railscarma","twitter_site":"@railscarma","twitter_misc":{"Skriven av":"ashish","Ber\u00e4knad l\u00e4stid":"3 minuter"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#article","isPartOf":{"@id":"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/"},"author":{"name":"ashish","@id":"https:\/\/www.railscarma.com\/#\/schema\/person\/9699b14852b308edfeb03096b33c7a7a"},"headline":"How To Read and Write Files in Ruby (With Examples)","datePublished":"2026-01-06T14:24:44+00:00","dateModified":"2026-01-06T14:24:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/"},"wordCount":468,"commentCount":0,"publisher":{"@id":"https:\/\/www.railscarma.com\/#organization"},"image":{"@id":"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/01\/How-To-Read-and-Write-Files-in-Ruby-With-Examples.png","articleSection":["Blogs"],"inLanguage":"sv-SE","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/","url":"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/","name":"Hur man l\u00e4ser och skriver filer i Ruby (med exempel) \u2013 RailsCarma","isPartOf":{"@id":"https:\/\/www.railscarma.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#primaryimage"},"image":{"@id":"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/01\/How-To-Read-and-Write-Files-in-Ruby-With-Examples.png","datePublished":"2026-01-06T14:24:44+00:00","dateModified":"2026-01-06T14:24:47+00:00","description":"L\u00e4r dig hur man l\u00e4ser och skriver filer i Ruby med tydliga exempel som t\u00e4cker File.read, File.write, block och b\u00e4sta praxis.","breadcrumb":{"@id":"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#breadcrumb"},"inLanguage":"sv-SE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/"]}]},{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#primaryimage","url":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/01\/How-To-Read-and-Write-Files-in-Ruby-With-Examples.png","contentUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/01\/How-To-Read-and-Write-Files-in-Ruby-With-Examples.png","width":800,"height":300,"caption":"Read and Write Files in Ruby"},{"@type":"BreadcrumbList","@id":"https:\/\/www.railscarma.com\/blog\/how-to-read-and-write-files-in-ruby-with-examples\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.railscarma.com\/"},{"@type":"ListItem","position":2,"name":"How To Read and Write Files in Ruby (With Examples)"}]},{"@type":"WebSite","@id":"https:\/\/www.railscarma.com\/#website","url":"https:\/\/www.railscarma.com\/","name":"RailsCarma - Ruby on Rails Development Company specialiserat p\u00e5 Offshore Development","description":"RailsCarma \u00e4r ett Ruby on Rails Development Company i Bangalore. Vi \u00e4r specialiserade p\u00e5 Offshore Ruby on Rails Development baserat i USA och Indien. Anst\u00e4ll erfarna Ruby on Rails-utvecklare f\u00f6r den ultimata webbupplevelsen.","publisher":{"@id":"https:\/\/www.railscarma.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.railscarma.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"sv-SE"},{"@type":"Organization","@id":"https:\/\/www.railscarma.com\/#organization","name":"RailsCarma","url":"https:\/\/www.railscarma.com\/","logo":{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png","contentUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png","width":200,"height":46,"caption":"RailsCarma"},"image":{"@id":"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RailsCarma\/","https:\/\/x.com\/railscarma","https:\/\/www.linkedin.com\/company\/railscarma\/","https:\/\/myspace.com\/railscarma","https:\/\/in.pinterest.com\/railscarma\/","https:\/\/www.youtube.com\/channel\/UCx3Wil-aAnDARuatTEyMdpg"]},{"@type":"Person","@id":"https:\/\/www.railscarma.com\/#\/schema\/person\/9699b14852b308edfeb03096b33c7a7a","name":"ashish","image":{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/www.railscarma.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/204411c7d72714bc32d5ac6398e0596896318386bd537860fdd14ce905a79e07?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/204411c7d72714bc32d5ac6398e0596896318386bd537860fdd14ce905a79e07?s=96&d=mm&r=g","caption":"ashish"}}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.railscarma.com\/sv\/wp-json\/wp\/v2\/posts\/40839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.railscarma.com\/sv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.railscarma.com\/sv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.railscarma.com\/sv\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.railscarma.com\/sv\/wp-json\/wp\/v2\/comments?post=40839"}],"version-history":[{"count":0,"href":"https:\/\/www.railscarma.com\/sv\/wp-json\/wp\/v2\/posts\/40839\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.railscarma.com\/sv\/wp-json\/wp\/v2\/media\/40850"}],"wp:attachment":[{"href":"https:\/\/www.railscarma.com\/sv\/wp-json\/wp\/v2\/media?parent=40839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.railscarma.com\/sv\/wp-json\/wp\/v2\/categories?post=40839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.railscarma.com\/sv\/wp-json\/wp\/v2\/tags?post=40839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}