Platinum Partner

Extract Part Of Class In Ruby Into Separate Class

When you need to split class into seveal parts...

New file:

  ClassPart = proc do
    
  end


Original class:

  class MainClass
    class_eval &ClassPart
    ...
  end


I used this approach to create a recycled bin: when i find some functionality not very valuable i move it to the 'recycled bin' part of class. i keep it there for a while. then i delete it altogether from code.
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}