Ruby is a dynamic, object-oriented programming language created by Yukihiro "Matz" Matsumoto and released in 1995. In Ruby almost everything, including numbers and nil, is an object, and the syntax favors readable, concise code.
Why it matters
Ruby became popular largely through Ruby on Rails, a web framework that popularized convention over configuration and rapid development. It is used for web applications, scripting, build tools and developer tooling such as Homebrew and Jekyll. Its flexibility, including open classes and metaprogramming, lets libraries define expressive domain-specific languages, though it can make large codebases harder to analyze and Ruby is slower than compiled languages.
Example
words = %w[ping trace dig]
lengths = words.map { |w| w.length }
puts lengths.inspect # [4, 5, 3]
map runs the block on each element and returns a new array. The block { |w| ... } is Ruby's closure syntax.
Common mistakes
- Monkey-patching core classes in ways that surprise other libraries.
- Triggering N+1 queries in Rails by looping over records without eager loading.
- Forgetting that only
nilandfalseare falsy, so0and empty strings count as true.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.