{"id":3560,"date":"2019-09-03T07:23:00","date_gmt":"2019-09-03T07:23:00","guid":{"rendered":"http:\/\/the-codest.localhost\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/"},"modified":"2026-04-27T09:52:00","modified_gmt":"2026-04-27T09:52:00","slug":"ruby-3-0-ruby-a-mene-zname-metody-kontroly-soukromi","status":"publish","type":"post","link":"https:\/\/thecodest.co\/cs\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/","title":{"rendered":"Ruby 3.0. Ruby a m\u00e9n\u011b zn\u00e1m\u00e9 metody kontroly soukrom\u00ed"},"content":{"rendered":"<h2 class=\"wp-block-heading\">Z\u00e1kladn\u00ed \u0159e\u0161en\u00ed<\/h2>\n\n\n\n<p>P\u0159edpokl\u00e1dejme, \u017ee pou\u017e\u00edv\u00e1me t\u0159\u00eddu Foo, kter\u00e1 m\u00e1 jednu ve\u0159ejnou a jednu soukromou metodu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">t\u0159\u00edda Foo\n  def bar\n    :awesome\n  end\n\n  private\n\n  def baz\n    :something_private\n  end\nend<\/code><\/pre>\n\n\n\n<p>V\u0161e je skv\u011bl\u00e9, takov\u00e9 \u0159e\u0161en\u00ed vid\u00edme prakticky v ka\u017ed\u00e9m <a href=\"https:\/\/thecodest.co\/cs\/dictionary\/why-do-projects-fail\/\">projekt<\/a>. B\u011bh <code>Foo.new.baz<\/code> zp\u016fsob\u00ed chybu <em>NoMethodError (soukrom\u00e1 metoda 'baz' vol\u00e1na pro # )<\/em> a to jsme cht\u011bli ud\u011blat. Co se stane, kdy\u017e se pokus\u00edme zm\u011bnit form\u00e1t ukl\u00e1d\u00e1n\u00ed a p\u0159id\u00e1me private jako p\u0159edponu v definici t\u0159\u00eddy?<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">t\u0159\u00edda Foo\n  def bar\n    :awesome\n  end\n\n  private def baz\n    :n\u011bco_soukrom\u00e9\n  end\nend<\/code><\/pre>\n\n\n\n<p>Jak vid\u00edte po spu\u0161t\u011bn\u00ed <a href=\"https:\/\/thecodest.co\/cs\/dictionary\/what-is-code-refactoring\/\">k\u00f3d<\/a>, skute\u010dn\u011b to funguje! Pro\u010d m\u016f\u017eeme p\u0159ed proveden\u00edm metody zadat jej\u00ed viditelnost? Proto\u017ee p\u0159i definici metody def vrac\u00ed n\u00e1zev metody jako symbol. Tento v\u00fdraz nen\u00ed jen sou\u010d\u00e1st\u00ed syntaxe, ale de facto metodou odvozenou od t\u0159\u00eddy Module a pova\u017euj\u00edc\u00ed tento symbol za argument. V\u00edce informac\u00ed naleznete v dokumentaci <a href=\"https:\/\/ruby-doc.org\/core-3.0.0\/Module.html#method-i-private\">na tomto odkazu<\/a>. Kdy\u017e u\u017e to tak snadno za\u010dalo s private, zkusme zm\u011bnit viditelnost metody private.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">t\u0159\u00edda Foo\n  def bar\n    :awesome\n  end\n\n  private def baz\n    :n\u011bco_soukrom\u00e9\n  end\n\n  public :baz\nend<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Co se stane po spu\u0161t\u011bn\u00ed k\u00f3du?<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">irb(main):012:0&gt; Foo.new.baz\n=&gt; :something_private<\/code><\/pre>\n\n\n\n<p>\u00dasp\u011bch! Na\u0161e metoda z\u00e1kladen se stala ve\u0159ejnou, proto\u017ee jsme ji dvakr\u00e1t zviditelnili. Stejn\u00e1 operace samoz\u0159ejm\u011b plat\u00ed i pro moduly.<br>\u200b<br>Skv\u011bl\u00e9, ale kam se dostane <a href=\"https:\/\/thecodest.co\/cs\/blog\/why-us-companies-are-opting-for-polish-developers\/\">n\u00e1s<\/a>?<br>\u200b<br>Tato funkce n\u00e1m d\u00e1v\u00e1 hodn\u011b, proto\u017ee m\u016f\u017eeme libovoln\u011b m\u011bnit viditelnost metody p\u0159i jej\u00ed definici, nebo dokonce m\u011bnit viditelnost metod p\u0159i jejich d\u011bd\u011bn\u00ed.<\/p>\n\n\n\n<p>Nyn\u00ed se pod\u00edvejme na to, co <a href=\"https:\/\/thecodest.co\/cs\/blog\/hire-ror-developer\/\">Ruby<\/a> 2.7, pokud jde o zm\u011bnu viditelnosti alias\u016f a accessor\u016f.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">t\u0159\u00edda Foo\n  private attr_accessor :awesome_variable\nend<\/code><\/pre>\n\n\n\n<p>Bohu\u017eel se objev\u00ed chyba, proto\u017ee priv\u00e1tn\u00ed metoda o\u010dek\u00e1v\u00e1 symboly a attr_accessor. K\u00f3d vrac\u00ed nil, a proto tato metoda nen\u00ed kompatibiln\u00ed s pou\u017eit\u00edm private v Ruby 2.7. Jak\u00e9 jsou tedy na\u0161e mo\u017enosti?<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>M\u016f\u017eeme pou\u017e\u00edt attr_accessor pod kl\u00ed\u010dov\u00fdm slovem private, aby to fungovalo, tj. dostaneme chybu, kdy\u017e se budeme cht\u00edt odk\u00e1zat na polo\u017eku <code>awesome_variableawesome_variable<\/code> metoda.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">t\u0159\u00edda Foo\n  private\n\n  attr_accessor :awesome_variable\nend<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>Druhou mo\u017enost\u00ed je spustit soukromou metodu na metod\u00e1ch generovan\u00fdch pomoc\u00ed <code>attr_attribute<\/code>; v tomto p\u0159\u00edpad\u011b mus\u00edme pamatovat i na zad\u00e1n\u00ed setteru.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">t\u0159\u00edda Foo\n  attr_accessor :awesome_variable\n\n  private :awesome_variable, :awesome_variable=\nend<\/code><\/pre>\n\n\n\n<p>Probl\u00e9my s <code>attr_ *<\/code> metody nejsou jedinou p\u0159ek\u00e1\u017ekou. Na stejn\u00fd probl\u00e9m m\u016f\u017eeme narazit, kdy\u017e chceme vytvo\u0159it soukrom\u00fd alias.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">t\u0159\u00edda Foo\n  private alias :bar, :awesome_bar\nend<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ruby 3.0 a na\u0161e podnik\u00e1n\u00ed<\/h2>\n\n\n\n<p>Na\u0161t\u011bst\u00ed Ruby 3.0 p\u0159in\u00e1\u0161\u00ed velkou zm\u011bnu, proto\u017ee metody viditelnosti mohou p\u0159ij\u00edmat pole jako argument a metody alias, attr_ *, mohou pole resetovat jm\u00e9ny definovan\u00fdch metod. M\u016f\u017eete si p\u0159e\u010d\u00edst v\u00edce <a href=\"https:\/\/redmine.ruby-lang.org\/issues\/17314\">zde<\/a>.<\/p>\n\n\n\n<p>Pod\u00edvejme se nyn\u00ed na n\u011bkolik p\u0159\u00edklad\u016f v nejnov\u011bj\u0161\u00ed verzi euby a zkontrolujme, zda byly zm\u011bny skute\u010dn\u011b provedeny a jak je m\u016f\u017eeme pou\u017e\u00edt.<br>\u200b<br>V prvn\u00edm p\u0159\u00edkladu pou\u017eijme private p\u0159ed accessorem attr:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">t\u0159\u00edda Foo\n  private attr_accessor :awesome_variable\nend<\/code><\/pre>\n\n\n\n<p>Takov\u00e9 vol\u00e1n\u00ed nezp\u016fsob\u00ed chybu p\u0159i anal\u00fdze syntaxe a, co\u017e je d\u016fle\u017eit\u00e9. <code>awesome_variable<\/code> a<code>awesome_variable =<\/code>metody se stanou soukrom\u00fdmi.<br>\u200b<br>Metoda alias ud\u011bl\u00e1 tot\u00e9\u017e, proto\u017ee nyn\u00ed vrac\u00ed symbol jako n\u00e1zev nov\u00e9 metody a zviditeln\u00ed ji.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">t\u0159\u00edda Foo\n  private alias :bar, :awesome_bar\nend<\/code><\/pre>\n\n\n\n<p>Zaj\u00edmav\u00e9 je, \u017ee se m\u016f\u017eeme pustit i do dal\u0161\u00edch metod, nap\u0159. do \u00fa\u017easn\u00e9 metody<em>modul print lze volat mezi private a attr<\/em>je d\u016fle\u017eit\u00e9, aby takov\u00e1 metoda vracela pole se jm\u00e9ny metod, kter\u00e9 jsou na prav\u00e9 stran\u011b v\u00fdrazu.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">t\u0159\u00edda Modul\n  def awesome_print(names)\n    puts names\n    names\n  end\nend\nt\u0159\u00edda Foo\n  private awesome_print attr_reader :awesome_bar\nend<span style=\"background-color: initial; font-family: inherit; font-size: inherit;\"> <\/span><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Souhrn<\/h2>\n\n\n\n<p>Douf\u00e1m, \u017ee pro v\u00e1s bude tento \u010dl\u00e1nek u\u017eite\u010dn\u00fd! V p\u0159\u00edpad\u011b dal\u0161\u00edch novinek o Ruby 3.0. \u010dt\u011bte v\u00edce <a href=\"https:\/\/rubyreferences.github.io\/rubychanges\/3.0.html\">zde<\/a>.<\/p>\n\n\n\n<p>\u0160\u0165astn\u00e9 k\u00f3dov\u00e1n\u00ed!<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/thecodest.co\/careers#offers]\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/ruby-1-.png\" alt=\"Nab\u00eddka pro v\u00fdvoj\u00e1\u0159e Ruby\"\/><\/a><\/figure>\n\n\n\n<p><strong>P\u0159e\u010dt\u011bte si v\u00edce:<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/shut-up-and-take-your-money-1-hidden-costs-and-real-agility-in-product-development-process\/\">Sklapni a vezmi si sv\u00e9 pen\u00edze #1: Skryt\u00e9 n\u00e1klady a skute\u010dn\u00e1 agilita v procesu v\u00fdvoje produktu<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/cto-challenges-scale-up-and-growth-of-software-products\/\">V\u00fdzvy CTO - roz\u0161i\u0159ov\u00e1n\u00ed a r\u016fst softwarov\u00fdch produkt\u016f<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Jednou z nejobl\u00edben\u011bj\u0161\u00edch vlastnost\u00ed jazyka Ruby je jeho velmi flexibiln\u00ed syntaxe. Osobn\u011b m\u00e1m Ruby r\u00e1d pro to, kolik mo\u017enost\u00ed m\u00e1me p\u0159i definov\u00e1n\u00ed t\u0159\u00edd a jejich vlastnost\u00ed, a pr\u00e1v\u011b o tom budu hovo\u0159it v tomto \u010dl\u00e1nku.<\/p>","protected":false},"author":2,"featured_media":3561,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-3560","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Ruby 3.0. Ruby and lesser known privacy control methods - The Codest<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thecodest.co\/cs\/blog\/ruby-3-0-ruby-a-mene-zname-metody-kontroly-soukromi\/\" \/>\n<meta property=\"og:locale\" content=\"cs_CZ\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ruby 3.0. Ruby and lesser known privacy control methods\" \/>\n<meta property=\"og:description\" content=\"One of the most beloved features of Ruby is its very flexible syntax. Personally, I love Ruby for how many possibilities we have in defining classes and their properties, and this is what I will discuss in this article.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/cs\/blog\/ruby-3-0-ruby-a-mene-zname-metody-kontroly-soukromi\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-03T07:23:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-27T09:52:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_3.0.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"thecodest\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"thecodest\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minuty\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/\"},\"author\":{\"name\":\"thecodest\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\"},\"headline\":\"Ruby 3.0. Ruby and lesser known privacy control methods\",\"datePublished\":\"2019-09-03T07:23:00+00:00\",\"dateModified\":\"2026-04-27T09:52:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/\"},\"wordCount\":588,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_3.0.png\",\"articleSection\":[\"Software Development\"],\"inLanguage\":\"cs\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/\",\"name\":\"Ruby 3.0. Ruby and lesser known privacy control methods - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_3.0.png\",\"datePublished\":\"2019-09-03T07:23:00+00:00\",\"dateModified\":\"2026-04-27T09:52:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/#breadcrumb\"},\"inLanguage\":\"cs\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"cs\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/#primaryimage\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_3.0.png\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_3.0.png\",\"width\":1280,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ruby 3.0. Ruby and lesser known privacy control methods\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"name\":\"The Codest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thecodest.co\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"cs\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"cs\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"width\":144,\"height\":36,\"caption\":\"The Codest\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/pl.linkedin.com\\\/company\\\/codest\",\"https:\\\/\\\/clutch.co\\\/profile\\\/codest\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\",\"name\":\"thecodest\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"cs\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"caption\":\"thecodest\"},\"url\":\"https:\\\/\\\/thecodest.co\\\/cs\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Ruby 3.0. Ruby a m\u00e9n\u011b zn\u00e1m\u00e9 metody kontroly soukrom\u00ed - The Codest","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:\/\/thecodest.co\/cs\/blog\/ruby-3-0-ruby-a-mene-zname-metody-kontroly-soukromi\/","og_locale":"cs_CZ","og_type":"article","og_title":"Ruby 3.0. Ruby and lesser known privacy control methods","og_description":"One of the most beloved features of Ruby is its very flexible syntax. Personally, I love Ruby for how many possibilities we have in defining classes and their properties, and this is what I will discuss in this article.","og_url":"https:\/\/thecodest.co\/cs\/blog\/ruby-3-0-ruby-a-mene-zname-metody-kontroly-soukromi\/","og_site_name":"The Codest","article_published_time":"2019-09-03T07:23:00+00:00","article_modified_time":"2026-04-27T09:52:00+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_3.0.png","type":"image\/png"}],"author":"thecodest","twitter_card":"summary_large_image","twitter_misc":{"Written by":"thecodest","Est. reading time":"3 minuty"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/#article","isPartOf":{"@id":"https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/"},"author":{"name":"thecodest","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76"},"headline":"Ruby 3.0. Ruby and lesser known privacy control methods","datePublished":"2019-09-03T07:23:00+00:00","dateModified":"2026-04-27T09:52:00+00:00","mainEntityOfPage":{"@id":"https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/"},"wordCount":588,"commentCount":0,"publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"image":{"@id":"https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_3.0.png","articleSection":["Software Development"],"inLanguage":"cs","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/","url":"https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/","name":"Ruby 3.0. Ruby a m\u00e9n\u011b zn\u00e1m\u00e9 metody kontroly soukrom\u00ed - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/#primaryimage"},"image":{"@id":"https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_3.0.png","datePublished":"2019-09-03T07:23:00+00:00","dateModified":"2026-04-27T09:52:00+00:00","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/#breadcrumb"},"inLanguage":"cs","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/"]}]},{"@type":"ImageObject","inLanguage":"cs","@id":"https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/#primaryimage","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_3.0.png","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_3.0.png","width":1280,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/blog\/ruby-3-0-ruby-and-lesser-known-privacy-control-methods\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"Ruby 3.0. Ruby and lesser known privacy control methods"}]},{"@type":"WebSite","@id":"https:\/\/thecodest.co\/#website","url":"https:\/\/thecodest.co\/","name":"The Codest","description":"","publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thecodest.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"cs"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"The Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"cs","@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","width":144,"height":36,"caption":"The Codest"},"image":{"@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/pl.linkedin.com\/company\/codest","https:\/\/clutch.co\/profile\/codest"]},{"@type":"Person","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76","name":"thecodest","image":{"@type":"ImageObject","inLanguage":"cs","@id":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","caption":"thecodest"},"url":"https:\/\/thecodest.co\/cs\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts\/3560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/comments?post=3560"}],"version-history":[{"count":14,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts\/3560\/revisions"}],"predecessor-version":[{"id":7980,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts\/3560\/revisions\/7980"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/media\/3561"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/media?parent=3560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/categories?post=3560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/tags?post=3560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}