Service Objects are classes or modules that have one public method, often named #call, and are designed to perform a single task or service.
Service objects are single business actions.
|# Given a set of arrays with potentially infinite lengths|
|# 1. interleave the elements from input collections into a|
|# final 1-dimensional array|
|# 2. ensure the interleaving follows a frequency, as example:|
|# - 1 element from collection A (frequency: 1)|
|# - 2 element from collection B (frequency: 2)|
|# - 3 element from collection C (frequency: 3)|
|# - 4 element from collection D (frequency: 4)|
|# helper to generate infinite enumerators|
This is an example of how to implement a "widget" with Ruby on Rails.
The widget is added to a webpage with the example on
This will request the JS code from the server, ensuring you can change it without having to update the webpage were the widget is.
When RubyCritic runs, each analysed class or module gets assigned a rating - a letter from A to F, A being the best. This serves as a baseline to tell you how smelly the code is. Generally A's & B's are good enough, C's serve as a warning and D's & F's are the ones you should be fixing.
Similarly, a global score that ranges from 0 to 100 is calculated, where higher values are better - less code smells detected. This provides a quick insight about the overall code quality.
RubyCritic's rating system was inspired by Code Climate's, you can [read more about how that works here].
|echo "* Updating system"|
|sudo apt-get update|
|sudo apt-get -y upgrade|
|echo "* Installing packages"|
|sudo apt-get -y install build-essential libxml2-dev libxslt1-dev git-core nginx redis-server postgresql-client libpq5 libpq-dev curl nodejs htop|
|sudo locale-gen pt_PT.UTF-8|
|sudo dpkg-reconfigure locales|
|echo "* Installing rvm"|