<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:base="https://nataliethistime.com/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Blog | Rose Harbour</title>
    <link>https://nataliethistime.com/</link>
    <atom:link href="https://nataliethistime.com/rss.xml" rel="self" type="application/rss+xml" />
    <description>Personal blog of Natalie Rose</description>
    <language>en</language>
    <item>
      <title>How I Wrote and Recorded my First Song</title>
      <link>https://nataliethistime.com/blog/2018-04-11-first-song/</link>
      <description>&lt;p&gt;The recording for this song began in early 2018. I was starting out as a music student at QUT and was keen to be working
on new music.&lt;/p&gt;
&lt;p&gt;This particular song came chorus first. Sometime in 2017 I was playing piano with a friend on bass and I stumbled across
what became the main vocal line of the chorus. The friend and I jammed on it for a while and then I recorded it as a
voice memo on my phone. I later found the recording and decided to sing it and fill the spaces with harmonies.&lt;/p&gt;
&lt;p&gt;At this point I had no idea where the song was coming from or going. So that was the next challenge. Fill out the rest
of the song, taking it from a glorified chorus to a whole statement of its own. I continued reaching into the past
through my voice memos and found a recording of my school’s bell sound. I used this to make the intro melody that you
hear while all the ambient effects were building up.&lt;/p&gt;
&lt;p&gt;All of this added up to an almost complete song, comprising an intro, chorus, chord progression, and harmonies. What
remained was to come up with a verse and then work out the final structure. I came up with a verse melody and ultimately
decided on a structure of intro, verse, chorus, solo, verse, chorus, solo, outtro.&lt;/p&gt;
&lt;p&gt;In this state the song remained for a month or two.&lt;/p&gt;
&lt;p&gt;Fast forward to April 2018, my family went away for a week and I stayed home to have some time to work. During this week
I did the solos, lyrics, lead vocal and filmed the video.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://nataliethistime.com/blog/2018-04-11-first-song/0XXWRfKNx5-2682.webp 2682w&quot;&gt;&lt;img src=&quot;https://nataliethistime.com/blog/2018-04-11-first-song/0XXWRfKNx5-2682.jpeg&quot; alt=&quot;Ableton Live session showing the audio tracks that make up the song&quot; width=&quot;2682&quot; height=&quot;1972&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;The solos were improvised. It took a few takes to get them right but otherwise nothing complex. I wrote the lyrics in
the late afternoon and then did the vocals that evening. The lyrics have shadows of meaning but generally I was being
silly with them.&lt;/p&gt;
&lt;p&gt;I think the only important lyric is the ‘public void’ bit. The first real programming project I attempted was an Android
app, using the Java programming language. All Java programs begin with something called the main function, which looks
like the following:&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code class=&quot;language-java&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;MyJavaProgram&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; args&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;out&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Hello, World&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See the public void in there? It’s like the beginning of something new.&lt;/p&gt;
&lt;p&gt;In filming the video I learnt a lot. This was my first time filming video with a DSLR camera as well as my first time
editing ‘multicam’ footage. Overall I think it looks good, except for the solos. As mentioned above, the solos were
improvised, which meant that I didn’t know exactly how to play them. I ended up miming along to the recording and it’s
just not convincing.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://nataliethistime.com/blog/2018-04-11-first-song/by-w1t9vG5-720.webp 720w&quot;&gt;&lt;img src=&quot;https://nataliethistime.com/blog/2018-04-11-first-song/by-w1t9vG5-720.jpeg&quot; alt=&quot;Video editing screenshot showing a few video tracks that made up the music video&quot; width=&quot;720&quot; height=&quot;1278&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;One more thing.&lt;/p&gt;
&lt;p&gt;My computer at the time wasn’t very powerful so I decided to edit the video on one of QUT’s computers. A friend of mine
was over one night and as they were leaving I asked if they could drop me off at the train station. This was at about
9:30pm and of course when I got there I realized I didn’t have my wallet. No train pass or money for tickets. I didn’t
want to be a bother, so I decided to try and fix this myself.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;It went well.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I sped walked home (40 minutes). Changed my clothes, repacked my stuff, double checked the dogs, and rode my bike back
to the station. I was tired from the walk, unfit, hungry, and struggling with the hills to get to the station. A recipe
for disaster.&lt;/p&gt;
&lt;p&gt;When I was within sight of the station both my calves cramped up and I fell pretty badly. I don’t remember being in a
lot of pain in that moment but I did stay lying on the ground for a long time. “What the fuck am I doing?” I wondered.
Eventually I got up, checked myself (including the computer in my backpack and the DSLR - more concerned about my
devices than my body), and limped to the station.&lt;/p&gt;
&lt;p&gt;I got to the train, found a bus to get to Kelvin Grove (it was the last one for the night, otherwise I would have had to
walk another kilometre or two) and finally made it. I cooked some left over noodles I’d brought and grabbed a Coke from
the vending machine. University diets are truly the best.&lt;/p&gt;
&lt;p&gt;At this point it was 1am. It took a while for me to get the multicam stuff right but after three hours I was happy that
it was okay. Uploaded at about 4:30am.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://nataliethistime.com/blog/2018-04-11-first-song/UnPapgUbgg-720.webp 720w&quot;&gt;&lt;img src=&quot;https://nataliethistime.com/blog/2018-04-11-first-song/UnPapgUbgg-720.jpeg&quot; alt=&quot;Bathroom selfie of boymode Natalie after being up all night. She is hiding her face behind the phone and exhausted.&quot; width=&quot;720&quot; height=&quot;1278&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;I then laid on the floor till the sun came up.&lt;/p&gt;
&lt;h2 id=&quot;lyrics&quot; tabindex=&quot;-1&quot;&gt;&lt;a class=&quot;header-anchor&quot; href=&quot;https://nataliethistime.com/blog/2018-04-11-first-song/#lyrics&quot;&gt;Lyrics&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It’s 123 but black and white&lt;br&gt; How long have you been in here?&lt;br&gt; Forever I will miss my chance&lt;br&gt; Ticking
clocks grind on, and on, and on…&lt;/p&gt;
&lt;p&gt;Like,&lt;br&gt; Ooooohhhhhh&lt;br&gt; Ooooohhhhhh&lt;/p&gt;
&lt;p&gt;A public void of fantasy&lt;br&gt; Send her down to the central park&lt;br&gt; Forever I will have my chance&lt;br&gt; But why why
why why??&lt;/p&gt;
&lt;p&gt;Like,&lt;br&gt; Ooooohhhhhh&lt;br&gt; Ooooohhhhhh&lt;/p&gt;
&lt;h2 id=&quot;listen-to-the-song&quot; tabindex=&quot;-1&quot;&gt;&lt;a class=&quot;header-anchor&quot; href=&quot;https://nataliethistime.com/blog/2018-04-11-first-song/#listen-to-the-song&quot;&gt;Listen to the song&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=5NbKaZNvsHI&quot;&gt;https://www.youtube.com/watch?v=5NbKaZNvsHI&lt;/a&gt;&lt;/p&gt;
</description>
      <pubDate>Wed, 11 Apr 2018 00:00:00 GMT</pubDate>
      <dc:creator>Natalie Rose</dc:creator>
      <guid>https://nataliethistime.com/blog/2018-04-11-first-song/</guid>
    </item>
    <item>
      <title>The Myth of Isolation Productivity</title>
      <link>https://nataliethistime.com/blog/2020-04-18-the-myth-of-isolation-productivity/</link>
      <description>&lt;p&gt;I don’t need to cover the story so far. COVID-19 is happening and it’s bad. Many are sick, many have lost their lives.
Many are scared. We are seeing tremendous unity whilst also being at our most isolated. Stories of triumph and survival
immediately followed by news of more storms. The future cost to us mentally, economically and socially is yet to be
determined.&lt;/p&gt;
&lt;p&gt;I’ve now been inside for over a month now, with the only trips out being to get coffee or groceries. It’s scary to read
the news and see what everyone is going through. Here in Queensland, Australia, we’re lucky to have few cases and
already daily new cases are dropping. Others all over the world are sadly not so lucky.&lt;/p&gt;
&lt;p&gt;For our essential workers, medical professionals, leaders (and too many others to name) this is a time to dig deep. For
the rest of us, we just need to stay inside.&lt;/p&gt;
&lt;p&gt;There’s been a lot of chatter about what to do during isolation. Suggestions abound and none of what I’ve seen is
particularity bad. &lt;strong&gt;However&lt;/strong&gt;, while it is true that some of us have more time than we used to, I think it’s far from
everyone.&lt;/p&gt;
&lt;p&gt;Consider:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Parents, now needing to babysit&lt;/li&gt;
&lt;li&gt;Those who have moved to working from home&lt;/li&gt;
&lt;li&gt;Those who are unemployed, now looking for work&lt;/li&gt;
&lt;li&gt;Those who are caring for others&lt;/li&gt;
&lt;li&gt;Those who are still learning (school or university)&lt;/li&gt;
&lt;li&gt;Those who are grieving&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you’re now at home with nothing to do, you are lucky. And if you feel motivated enough to improve yourself in some
way, I implore you to do so! But not at the cost of your sanity.&lt;/p&gt;
&lt;p&gt;It’s easy to overestimate yourself. Have you ever set a new year’s resolution and then not stuck to it? Of course you
have.&lt;/p&gt;
&lt;p&gt;We’re facing a similar issue now. At any given time, it’s easy to assemble a list of things you can improve about
yourself. But it’s overwhelming to try and action everything all at once.&lt;/p&gt;
&lt;p&gt;Be gentle on yourself and others. Do what you can to make things better. You don’t have to change the world right now.
You just have to keep going.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Productivity is hard.&lt;/p&gt;
&lt;p&gt;Make sure to set reasonable goals for yourself.&lt;/p&gt;
&lt;p&gt;Stay safe out there everyone.&lt;/p&gt;
</description>
      <pubDate>Sat, 18 Apr 2020 00:00:00 GMT</pubDate>
      <dc:creator>Natalie Rose</dc:creator>
      <guid>https://nataliethistime.com/blog/2020-04-18-the-myth-of-isolation-productivity/</guid>
    </item>
    <item>
      <title>GitHub Default Branch</title>
      <link>https://nataliethistime.com/blog/2020-06-19-github-default-branch/</link>
      <description>&lt;p&gt;Two days ago GitHub changed their default branch name from &lt;code&gt;master&lt;/code&gt; to &lt;code&gt;main&lt;/code&gt;. Though this was not mentioned on
their &lt;a href=&quot;https://github.blog/&quot;&gt;blog&lt;/a&gt; or &lt;a href=&quot;https://github.blog/changelog/&quot;&gt;changelog&lt;/a&gt; it
was &lt;a href=&quot;https://www.bbc.com/news/technology-53050955&quot;&gt;reported on&lt;/a&gt; fairly widely. It
reached &lt;a href=&quot;https://news.ycombinator.com/item?id=23531032&quot;&gt;Hacker News&lt;/a&gt; wherein many discussions occurred. Many response
articles have been written, which are worth a read if you’re interested.&lt;/p&gt;
&lt;p&gt;I think there are two questions at play: &lt;em&gt;Why&lt;/em&gt; should it be changed? and &lt;em&gt;What&lt;/em&gt; should it be changed to?&lt;/p&gt;
&lt;p&gt;The question of &lt;em&gt;What&lt;/em&gt; is fairly simple, just pick one. I would suggest one of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;trunk&lt;/li&gt;
&lt;li&gt;main&lt;/li&gt;
&lt;li&gt;home&lt;/li&gt;
&lt;li&gt;root&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The question of &lt;em&gt;Why&lt;/em&gt; is the real source of controversy.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Is anyone actually offended by this language?&lt;/em&gt; I don’t know.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Does this language actually carry the master/slave connotation that is being claimed?&lt;/em&gt; Many feel not.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Is it easier to do nothing?&lt;/em&gt; Certainly.&lt;/p&gt;
&lt;p&gt;My reading from the discussions is that many are seeing the change of the default name as a signal that they now have to
change the &lt;code&gt;master&lt;/code&gt; branch on all of their existing repositories. Which is a legitimate hassle. Many are seeing this as
a slippery slope - who can tell where it leads?&lt;/p&gt;
&lt;p&gt;Here’s what I think. The programming community is diverse and it’s hard to know for certain whether terms are offensive
(or even just &lt;em&gt;‘a little bit off’&lt;/em&gt;). The database community has already had this discussion and the action taken was to
rename &lt;code&gt;master&lt;/code&gt;/&lt;code&gt;slave&lt;/code&gt; to &lt;code&gt;primary&lt;/code&gt;/&lt;code&gt;replica&lt;/code&gt;. If the term “master branch” has any semblance of the same dichotomy
(which it can), then the best course is to change the term.&lt;/p&gt;
&lt;p&gt;Renaming the branch will break some tools. It can be a pain in the ass. But if this use of terminology is making the
development work of anyone more difficult than it needs to be, then I’m all for it.&lt;/p&gt;
&lt;p&gt;I have recently contributed to a script for automatically making this
change: &lt;a href=&quot;https://github.com/mheap/github-default-branch&quot;&gt;github-default-branch&lt;/a&gt;. It can scan through your user account
or organisation to rename &lt;code&gt;master&lt;/code&gt; to &lt;code&gt;main&lt;/code&gt; (or any other name you specify) automatically. It also updates references
in Pull Requests, changes certain references in text files, and fixes branch protection rules. I had this issue fixed
for all of my repositories in an evening (including needing to fix a bug in the script).&lt;/p&gt;
&lt;p&gt;As for where this is going, all I can say is ‘somewhere’. There were several references to Newspeak in the
aforementioned discussions, which I find to be bland and ignorant. Words fucking matter. And they matter differently to
different individuals.&lt;/p&gt;
&lt;p&gt;The idea that you can make references to Orwell and think you’re clever is flippant and misses the point of this
discussion. Which is that to create a system that is reasonably fair, reasonably safe, and reasonably usable, you must
be willing to make changes.&lt;/p&gt;
&lt;p&gt;P.S. Today is Juneteenth. Black Lives Matter. Defund the Police. Have a nice day :)&lt;/p&gt;
&lt;p&gt;P.P.S. Octocat header art by &lt;a href=&quot;https://dribbble.com/marwative&quot;&gt;Marwative&lt;/a&gt;&lt;/p&gt;
</description>
      <pubDate>Fri, 19 Jun 2020 00:00:00 GMT</pubDate>
      <dc:creator>Natalie Rose</dc:creator>
      <guid>https://nataliethistime.com/blog/2020-06-19-github-default-branch/</guid>
    </item>
    <item>
      <title>To Import or Perhaps Not?</title>
      <link>https://nataliethistime.com/blog/2020-09-23-to-import-or-perhaps-not/</link>
      <description>&lt;p&gt;I keep a journal using a little Rails app I built. Nothing super fancy. It’s just so I can write what I’m thinking and
feeling throughout the day. Every so often I look back and think about whether I’m okay with how things are going.&lt;/p&gt;
&lt;p&gt;Some issues came up and I ended up merging my journalling app functionality into another personal project. The
application code was really simple but of course the old entries needed to get moved across as well. So the objective
was to get the entries out of the old Postgres database and into a new one. Along the way one column needed to be
renamed as well.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;How hard can it be?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Ugh.&lt;/p&gt;
&lt;p&gt;I first tried to use &lt;a href=&quot;https://github.com/sferik/rails_admin&quot;&gt;Rails Admin&lt;/a&gt; to export the entries. Soon afterward, I
discovered that it doesn’t have an import function. So it was possible to download the entries but not import them into
the new database.&lt;/p&gt;
&lt;p&gt;Next I tried to use &lt;a href=&quot;https://www.pgadmin.org/&quot;&gt;pgAdmin&lt;/a&gt; to export the entries as some kind of &lt;code&gt;csv&lt;/code&gt; file and then import
them into the new database. Was I able to get this to work? Nope! The import always failed because of something wrong
with the date format in the source file.&lt;/p&gt;
&lt;p&gt;(This stunt was made particularly difficult by &lt;a href=&quot;https://www.heroku.com/&quot;&gt;Heroku&lt;/a&gt; hobby datastores, which appear to
contain hundreds of databases pertaining to different Heroku user’s applications. Obviously your user can only access
your own database table but the performance implications were fascinating. It looked like there were 50-100 reads
occurring every second. This is why it’s free and also slow sometimes!)&lt;/p&gt;
&lt;p&gt;&lt;em&gt;So what worked?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Okay, here we go:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download a &lt;code&gt;json&lt;/code&gt; file of the entires using Rails Admin&lt;/li&gt;
&lt;li&gt;Edit the file to make the column changes that were required&lt;/li&gt;
&lt;li&gt;Upload the file to a private Github Gist&lt;/li&gt;
&lt;li&gt;Run the following Ruby code in the &lt;code&gt;rails console&lt;/code&gt; of the destination app:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;language-ruby&quot;&gt;&lt;code class=&quot;language-ruby&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&#39;json&#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&#39;net/http&#39;&lt;/span&gt;&lt;/span&gt;

url &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;URI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&#39;&amp;lt;Github Gist url here&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
entries &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Net&lt;span class=&quot;token double-colon punctuation&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;HTTP&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;get&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

entries&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;entry&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;
  e &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; PersonalLog&lt;span class=&quot;token double-colon punctuation&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Entry&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;
  e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;content &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; entry&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&#39;content&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
  e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;created_at &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;Time&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;zone&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;entry&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&#39;created_at&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;updated_at &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;Time&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;zone&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;entry&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&#39;updated_at&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  e&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;save&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This worked but I’m convinced that there was a better way eluding me.&lt;/p&gt;
&lt;p&gt;&#39;Till next time, I guess.&lt;/p&gt;
</description>
      <pubDate>Wed, 23 Sep 2020 00:00:00 GMT</pubDate>
      <dc:creator>Natalie Rose</dc:creator>
      <guid>https://nataliethistime.com/blog/2020-09-23-to-import-or-perhaps-not/</guid>
    </item>
    <item>
      <title>My Take on Decoration Methods in Ruby</title>
      <link>https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/</link>
      <description>&lt;h2 id=&quot;contents&quot; tabindex=&quot;-1&quot;&gt;&lt;a class=&quot;header-anchor&quot; href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#contents&quot;&gt;Contents&lt;/a&gt;&lt;/h2&gt;
&lt;nav class=&quot;table-of-contents&quot;&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#contents&quot;&gt;Contents&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#introduction&quot;&gt;Introduction&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#the-rails-way&quot;&gt;The “Rails Way”&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#enter-mini-decorator&quot;&gt;Enter mini_decorator&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#getting-started&quot;&gt;Getting Started&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#usage-without-rails&quot;&gt;Usage without Rails&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#implementation-details&quot;&gt;Implementation Details&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/nav&gt;&lt;h2 id=&quot;introduction&quot; tabindex=&quot;-1&quot;&gt;&lt;a class=&quot;header-anchor&quot; href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#introduction&quot;&gt;Introduction&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One of the fundamentals of computing is that the way that information is presented on the screen is different to the way
that it is stored or processed. Today’s date, for instance, could be stored as a number (&lt;code&gt;1620000000&lt;/code&gt;) or as a string
(&lt;code&gt;2021-05-03 00:00:00 +0000&lt;/code&gt;) or really any format. There will always be multiple different ways of storing information
and this is fine. The challenge I want to talk about today though is organising the code for rendering this information
in Ruby on Rails applications.&lt;/p&gt;
&lt;h2 id=&quot;the-rails-way&quot; tabindex=&quot;-1&quot;&gt;&lt;a class=&quot;header-anchor&quot; href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#the-rails-way&quot;&gt;The “Rails Way”&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Traditionally, this would be done with helper methods.&lt;/p&gt;
&lt;p&gt;For example you might have a set of helpers defined as below:&lt;/p&gt;
&lt;pre class=&quot;language-ruby&quot;&gt;&lt;code class=&quot;language-ruby&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;PersonHelper&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;person_full_name&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;person&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;token content&quot;&gt;person&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;first_name&lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;token content&quot;&gt;person&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;last_name&lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;person_birthday&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;person&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; person&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;birthday&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;blank&lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt;
    person&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;birthday&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;strftime &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&#39;%m/%d/%Y&#39;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then in your view code you would use these like so:&lt;/p&gt;
&lt;pre class=&quot;language-erb&quot;&gt;&lt;code class=&quot;language-erb&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;List of People and Their Birthdays&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;table&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;thead&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;tr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;th&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Full Name&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;th&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;th&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Birthday&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;th&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;tr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;thead&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;tbody&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token erb language-erb&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span class=&quot;token ruby language-ruby&quot;&gt; &lt;span class=&quot;token variable&quot;&gt;@people&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;person&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;%&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;tr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;td&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token erb language-erb&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;&amp;lt;%=&lt;/span&gt;&lt;span class=&quot;token ruby language-ruby&quot;&gt; person_full_name&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;person&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;%&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;td&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;td&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token erb language-erb&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;&amp;lt;%=&lt;/span&gt;&lt;span class=&quot;token ruby language-ruby&quot;&gt; person_birthday&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;person&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;%&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;td&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;tr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token erb language-erb&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span class=&quot;token ruby language-ruby&quot;&gt; &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt; &lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;%&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;tbody&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;table&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This &lt;em&gt;works&lt;/em&gt; but there’s a few things to note.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Rails helpers are global. So you have to give each helper a unique name. It can also be difficult to tell where
functionality is coming from.&lt;/li&gt;
&lt;li&gt;Helpers are detached from the object they relate to. So you have to pass the object into the helper each time you use
it.&lt;/li&gt;
&lt;li&gt;Helpers can end up duplicating functionality because it’s difficult to share it. You could end up in a situation
where helpers are guessing what kind of thing they’re looking at and potentially acting incorrectly.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I also had the personal barrier of this solution just not ‘feeling right’. I was new to a Rails codebase at the time and
couldn’t wrap my head around where all of the helpers were. The naming conventions weren’t clear and I had a hard time
looking at various components and figuring out if they were important or not.&lt;/p&gt;
&lt;p&gt;So I hacked my own solution and &lt;a href=&quot;https://rubygems.org/gems/mini_decorator&quot;&gt;made it available as a Ruby Gem&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;enter-mini-decorator&quot; tabindex=&quot;-1&quot;&gt;&lt;a class=&quot;header-anchor&quot; href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#enter-mini-decorator&quot;&gt;Enter &lt;code&gt;mini_decorator&lt;/code&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On &lt;a href=&quot;https://github.com/1vasari/mini_decorator&quot;&gt;GitHub&lt;/a&gt; I describe it as:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Minimal decoration of Ruby objects using a &lt;code&gt;decorate&lt;/code&gt; method. The idea is to create the thinnest possible layer of
abstraction between presentational methods and ‘work’ methods. I was inspired by gems such
as &lt;a href=&quot;https://github.com/drapergem/draper&quot;&gt;Draper&lt;/a&gt;, but felt like they were doing too much. Going back to the person
name/birthday example above, with my solution the implementation would be something akin to this.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Define a person decorator (note, the heuristic similarity to helpers):&lt;/p&gt;
&lt;pre class=&quot;language-ruby&quot;&gt;&lt;code class=&quot;language-ruby&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# app/decorators/person_decorator.rb&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;PersonDecorator&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;full_name&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;person&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;token content&quot;&gt;person&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;first_name&lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;token content&quot;&gt;person&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;last_name&lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;birthday&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;person&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; person&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;birthday&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;blank&lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt;
    person&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;birthday&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;strftime &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&#39;%m/%d/%Y&#39;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Join the decorator into the model:&lt;/p&gt;
&lt;pre class=&quot;language-ruby&quot;&gt;&lt;code class=&quot;language-ruby&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# app/models/person.rb&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; ApplicationRecord
  &lt;span class=&quot;token comment&quot;&gt;# Imagine there&#39;s other model stuff in here&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;# such as relations or validation..&lt;/span&gt;
  decorate_with PersonDecorator
&lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And finally, you would call the &lt;code&gt;decorate&lt;/code&gt; method, passing in the attribute you want to render:&lt;/p&gt;
&lt;pre class=&quot;language-erb&quot;&gt;&lt;code class=&quot;language-erb&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;List of People and Their Birthdays&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;h1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;table&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;thead&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;tr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;th&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Full Name&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;th&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;th&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Birthday&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;th&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;tr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;thead&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;tbody&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token erb language-erb&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span class=&quot;token ruby language-ruby&quot;&gt; &lt;span class=&quot;token variable&quot;&gt;@people&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;person&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;%&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;tr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;td&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token erb language-erb&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;&amp;lt;%=&lt;/span&gt;&lt;span class=&quot;token ruby language-ruby&quot;&gt; person&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;decorate&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token symbol&quot;&gt;:full_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;%&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;td&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;td&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token erb language-erb&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;&amp;lt;%=&lt;/span&gt;&lt;span class=&quot;token ruby language-ruby&quot;&gt; person&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;decorate&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token symbol&quot;&gt;:birthday&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;%&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;td&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;tr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token erb language-erb&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span class=&quot;token ruby language-ruby&quot;&gt; &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt; &lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;%&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;tbody&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;table&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I’ve found this system very useful for keeping decoration methods separate from model code but still organised and
testable.&lt;/p&gt;
&lt;p&gt;The other thing &lt;code&gt;mini_decorator&lt;/code&gt; handles nicely is changing formats or choosing to format attributes that weren’t being
formatted before. If you call &lt;code&gt;person.decorate(:email)&lt;/code&gt; (which isn’t a decorator in our examples) then you will get the
raw &lt;code&gt;email&lt;/code&gt; attribute from the &lt;code&gt;Person&lt;/code&gt; object. You can then later define a decorator for &lt;code&gt;email&lt;/code&gt; which then is used
instead of the raw value.&lt;/p&gt;
&lt;p&gt;This system isn’t perfect. But it feels better to me and I enjoy using it instead of polluting the global namespace, or
mixing formatting code into model code.&lt;/p&gt;
&lt;h2 id=&quot;getting-started&quot; tabindex=&quot;-1&quot;&gt;&lt;a class=&quot;header-anchor&quot; href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#getting-started&quot;&gt;Getting Started&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Add &lt;code&gt;mini_decorator&lt;/code&gt; to your Gemfile and then &lt;code&gt;bundle install&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-ruby&quot;&gt;&lt;code class=&quot;language-ruby&quot;&gt;gem &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&#39;mini_decorator&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&#39;0.0.2&#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You will also need to set up the &lt;code&gt;decorate_with&lt;/code&gt; method in your model base class, usually called &lt;code&gt;ApplicationRecord&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-ruby&quot;&gt;&lt;code class=&quot;language-ruby&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;ApplicationRecord&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span class=&quot;token double-colon punctuation&quot;&gt;::&lt;/span&gt;Base
  &lt;span class=&quot;token keyword&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;abstract_class &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;decorate_with&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;decorator&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;MiniDecorator&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;decorator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can then create decorator classes and use them in your models. Hooray!&lt;/p&gt;
&lt;p&gt;In addition to this, I usually create a &lt;code&gt;DecoratorBase&lt;/code&gt; class that all decorators inherit from. Something like the
following is a nice starting point:&lt;/p&gt;
&lt;pre class=&quot;language-ruby&quot;&gt;&lt;code class=&quot;language-ruby&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;DecoratorBase&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;helpers&lt;/span&gt;&lt;/span&gt;
    ApplicationController&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;helpers
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;routes&lt;/span&gt;&lt;/span&gt;
    Rails&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;application&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;routes&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url_helpers
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;localize&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;args&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    I18n&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;localize&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;args&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;updated_at&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;item&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    localize item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;updated_at&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token symbol&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token symbol&quot;&gt;:short&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;updated_at_ago&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;item&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;token content&quot;&gt;helpers&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;time_ago_in_words&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;updated_at&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; ago&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;created_at&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;item&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    localize item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;created_at&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token symbol&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token symbol&quot;&gt;:short&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;created_at_ago&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;item&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token string-literal&quot;&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;token content&quot;&gt;helpers&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;time_ago_in_words&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;item&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;created_at&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; ago&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;usage-without-rails&quot; tabindex=&quot;-1&quot;&gt;&lt;a class=&quot;header-anchor&quot; href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#usage-without-rails&quot;&gt;Usage without Rails&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The implementation of &lt;code&gt;mini_decorator&lt;/code&gt; currently doesn’t use any Rails-specific trickery, so you’re perfectly safe using
this library in non-Rails apps.&lt;/p&gt;
&lt;h2 id=&quot;implementation-details&quot; tabindex=&quot;-1&quot;&gt;&lt;a class=&quot;header-anchor&quot; href=&quot;https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/#implementation-details&quot;&gt;Implementation Details&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;mini_decorator&lt;/code&gt; is actually only a few lines of Ruby code. You can see the whole mess below.&lt;/p&gt;
&lt;p&gt;Note the extending from &lt;code&gt;Module&lt;/code&gt; trick is because &lt;code&gt;include&lt;/code&gt; only accepts modules but we still want to be able to pass a
parameter into it. This allows us to write &lt;code&gt;include MiniDecorator.new(MyFancyDecorator.new)&lt;/code&gt; in the class body of the
object we’re decorating.&lt;/p&gt;
&lt;pre class=&quot;language-ruby&quot;&gt;&lt;code class=&quot;language-ruby&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;MiniDecorator&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;Module&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token method-definition&quot;&gt;&lt;span class=&quot;token function&quot;&gt;initialize&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;decorator&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;define_method&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token symbol&quot;&gt;:decorate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;property&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; decorator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;respond_to&lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; property
        decorator&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;public_send&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;property&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;elsif&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;respond_to&lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; property
        &lt;span class=&quot;token keyword&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;public_send&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;property&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;raise&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;NoMethodError&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
          &quot;No decorator &lt;span class=&quot;token keyword&quot;&gt;or&lt;/span&gt; object method
            found &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; property&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;#{property}&quot;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Hopefully this helps and if you ever end up using &lt;code&gt;mini_decorator&lt;/code&gt; for anything, I would love to know!&lt;/p&gt;
</description>
      <pubDate>Mon, 03 May 2021 00:00:00 GMT</pubDate>
      <dc:creator>Natalie Rose</dc:creator>
      <guid>https://nataliethistime.com/blog/2021-05-03-my-take-on-decoration-methods-in-ruby/</guid>
    </item>
    <item>
      <title>How Change Happens</title>
      <link>https://nataliethistime.com/blog/2025-10-17-how-change-happens/</link>
      <description>&lt;p&gt;So things are pretty grim right now, aren’t they?&lt;/p&gt;
&lt;p&gt;I certainly feel so.&lt;/p&gt;
&lt;p&gt;Since the pandemic, being alive has felt like an exercise in massocism, going from one unprecedented event to the next.
What’s worse is that algorithmic feeds and sycophantic AI agents have silo’d us into prisons that push all of our
emotional buttons and ensure that we are more polarised/anxious/confused than ever before.&lt;/p&gt;
&lt;p&gt;Looking at the news and seeing how people talk online… my heart breaks. People who I am sure are otherwise good -
especially if you spend time getting to know them - have accepted and espouse hateful rhetoric. Evil political leaders
with “common sense” answers have taken advantage of this so now there’s nazi piss and shit everywhere.&lt;/p&gt;
&lt;p&gt;Considering all of this, I’ve often wondered lately if democracy was a mistake. Or at least is in need of a major
overhaul. The average human mind just doesn’t seem to be very good at thinking about the needs of every person vs the
needs of themself. There’s an entire planet of systems and levers but the only thing that gets people to the polls is
depraved slogans like “adult crime, adult time” (a successful line that got Queenslanders to vote for putting children
in jail).&lt;/p&gt;
&lt;p&gt;It’s infuriating to me that everything is up for debate. For instance people who &lt;em&gt;don’t know anything&lt;/em&gt; about being
transgender get the same voting power (or perhaps more depending on geographical factors such as gerrymandering) as me,
a trans woman of three years’ lived experience.&lt;/p&gt;
&lt;p&gt;The conservative “government should be as small as possible” argument fascinates me. Because if we could agree that some
things are &lt;strong&gt;not up for debate&lt;/strong&gt; (ie, basic human rights for all, health care for all, stop the genocide, end all wars)
then perhaps I’d be on board?? Imaging skipping all of that and just making sure that the trains work. But it just ain’t
so and it never will be.&lt;/p&gt;
&lt;p&gt;So we are doomed to the lowest common denominator.&lt;/p&gt;
&lt;p&gt;Every issue needs to take into account every viewpoint, even if it’s reprehensible, and so every time I’ve gone to the
polls the last few years it’s been with great reluctance. The left-leaning major party is certainly better than the
other one but they’re still going to enact weak policies.&lt;/p&gt;
&lt;p&gt;This leaves us with a pathway to change that I think looks as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;An issue exists&lt;/li&gt;
&lt;li&gt;Symptoms affect an increasing number of people&lt;/li&gt;
&lt;li&gt;Solutions are proposed, discussed, protested over&lt;/li&gt;
&lt;li&gt;Eventually a majority of people agree&lt;/li&gt;
&lt;li&gt;If the majority of leaders agree with the majority of people then the change occurs&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I use the term &lt;code&gt;symptoms&lt;/code&gt; very deliberately. No matter how good an idea is, it won’t gain traction unless it’s affecting
a lot of people. So-called “Australia”&#39;s treatment of its indigenous people is a prime example of this. The Australian
people are broadly cruel, selfish and racist and so they don’t care about how badly treated the Aboriginal people are.
Any attempt to improve outcomes for Aboriginal people is “woke” or dangerous or unfair. I am embarrased to be an
Australian because of this and it’s possible that in my lifetime there won’t be meaningful change.&lt;/p&gt;
&lt;p&gt;Issues with climate can be seen in a similar manner. Any policy to mitigate the risk of climate catastrophe will be
tokenistic at best until it gets so bad that it cannot be ignored. Climate change won’t be the end of human life on
earth - because we are resilient and will persist - however the cruel destruction to lives and ecosystems will be
unimaginable before we get to that point.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;To most reasonable people, the developments of the last few years feel to represent an overwhelming step backwards. And
it’s true: a massive amount of real harm has been done to innocent people, a lot of which will never be answered for.&lt;/p&gt;
&lt;p&gt;But the end of all this is coming soon.&lt;/p&gt;
&lt;p&gt;Fascism always burns itself out. Their methods and arguments are getting more extreme not because they are winning… but
because they are losing momentum and becoming more desperate to keep up the lies. The more desperate they become the
more insane they will be until eventually they die. The orange fuckhead’s administration will be remembered as
incompetent and Republicans will be shamed into silence for the next decade.&lt;/p&gt;
&lt;p&gt;It’s only a relative handful of votes that flipped red over the last few years.&lt;/p&gt;
&lt;p&gt;And the path back is long and fraught with danger.&lt;/p&gt;
&lt;p&gt;But it’s already happening.&lt;/p&gt;
&lt;p&gt;The wind is blowing the other way.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://nataliethistime.com/blog/2025-10-17-how-change-happens/Fkbn0EIGfu-4284.webp 4284w&quot;&gt;&lt;img src=&quot;https://nataliethistime.com/blog/2025-10-17-how-change-happens/Fkbn0EIGfu-4284.jpeg&quot; alt=&quot;Sunset pic I took in my local park this evening&quot; width=&quot;4284&quot; height=&quot;5712&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
</description>
      <pubDate>Fri, 17 Oct 2025 00:00:00 GMT</pubDate>
      <dc:creator>Natalie Rose</dc:creator>
      <guid>https://nataliethistime.com/blog/2025-10-17-how-change-happens/</guid>
    </item>
  </channel>
</rss>