Ruby Way

last modified: November 14, 2011

Doing something a very elegant way that only the programming language Ruby enables you to.

For example?


copied from RubyLanguage:

More than most OO language coders, Rubyists tend to believe in the PowerOfPlainText, using neat-o formats like YamlAintMarkupLanguage, TextileFormat, Wiki and Ruby's own native RdocFormat. While tools for all of these (except RDoc) existed in other languages first, Ruby's small developer base has allowed a very nice ecosystem to grow up around them. This seems to be becoming an integral part of the RubyWay; as far as I know Ruby 1.8 is the only language out there with YAML support in the core library distribution.


Probably the motto should just be "doing something in a very elegant way". As an example consider the ActiveRecord implementation in ruby : You create the sql tables and then write this:

class Project < ActiveRecord::Base
  belongs_to              :portfolio
  has_one                 :project_manager
  has_many                :milestones
  has_and_belongs_to_many :categories
end

done. Now you can write:

if my_project.project_manager? joe
  my_project.milestones << another_milestone
else
  my_project.portfolio= some_pf
end
puts my_project.categories_count

(from http://ar.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html)

Yes, but: http://elixir.ematia.de/apidocs/elixir.relationships.html#dsl-based-syntax

I'm calling a GreencoddsTenthRuleOfProgramming on this one. --top


CategoryRuby


Loading...