Author: admin
-
How To Merge Strings?
Use interpolation to merge strings instead of using concatenation. Comparatively, Interpolation would be faster than the concatenation. Don’ts Do’s
-
Use .tap To Perform Operations And To Return The Object
Ruby .tap method is used to yields the object to the block and will return the modified object. For example, Don’ts Do’s
-
Use Rescue Blocks Properly
Rescue blocks always not required to use with ‘begin.’ If you are going to use only begin and rescue block in the method, then you can skip the begin. Don’ts Do’s
-
Try To Use “Ternary” Operator
Many developers will use the “if-else” statement for single line functions, For example,def role(admin) if admin == “admin” return true else return false end end Why we don’t start using a ternary here?def role(admin)
-
Use the .map Method To Iterate And To Return Modified Object
Developers have to understand the difference between .map and .each methods. When using these functions try to choose the appropriate method based on the situations.For example, If you want to return the vowels array in the capital letter then use .map method, Don’ts Do’s Related: Top Companies That Use Ruby on Rails
-
Mass Variable Assignments
Mass assignment is a useful feature to assign multiple variables in a single place. We can use it to return the multiple values from the method and this returned value can be assigned by Mass variable assignments. Don’ts Do’s
-
Use Fetch To Find Value From The Hash
Using hash[] method we can return the value. It will return the value if the key exists, else it will return nil.Using hash fetch method will also do the same but additionally, it will give few options like assigning a default value, executing block, etc.Here are some examples Don’ts Do’s Don’ts Do’s
-
homebrew-cask
Homebrew-Cask extends Homebrew and brings its elegance, simplicity, and speed to the installation and management of GUI macOS applications such as Atom and Google Chrome.We do this by providing a friendly Homebrew-style CLI workflow for the administration of macOS applications distributed as binaries.
-
thor
thor is a simple and efficient tool for building self-documenting command line utilities.It removes the pain of parsing command line options, writing “USAGE:” banners, and can also be used as an alternative to the Rake build tool.The syntax is Rake-like, so it should be familiar to most Rake users.
-
vagrant
Vagrant is a tool for building and distributing development environments.Development environments managed by Vagrant can run on local virtualized platforms such as VirtualBox or VMware, in the cloud via AWS or OpenStack, or in containers such as with Docker or raw LXC.Vagrant provides the framework and configuration format to create and manage complete portable development…