My experience at the awesome, first-ever GopherCon 2014

My Objectives My company JoshSoftware, based in Pune India, sponsored my trip to the first-ever Go programming conference - GopherCon in Denver, CO, USA from April 23-26, 2014. Yours truly at the conference JoshSoftware is now Diving into Go and as such, there were some clear objectives for my visit to this conference - Get … Continue reading My experience at the awesome, first-ever GopherCon 2014

Part 4: Ruby Through Rails — Bundler DSL

Where is ‘new’ defined in Ruby? What does instance_eval do? How is a Gemfile parsed? Did you know that “gem”, “source” and “ruby” are method defined in the Bundler gem? Read and learn about more constructs and the Bundler DSL for parsing the Gemfile.

Sanjiv Kumar Jha's avatarnarutosanjiv

Bundler::Dsl class is defined inside the lib/bundler/dsl.rb. Earlier we have learned how various settings get set like the bundle path and gem path. Now we are going to learn how the Gemfile is parsed and evaluated. Bundler::Dsl.evaluate gets called from Bundler::Definition#build function.

‘evaluate’ method is singleton method on class Dsl and the parameters passed to it are Gemfile path, Gemfile.lock path and a boolean field from Bundler::Definition#build function. In above function, it calls the ‘new’ function. There is nothing new about the ‘new’ function. It basically creates the object for a class. Howevr, have you ever given thought where ‘new’ function defined?

What is the ‘new’ function in Ruby?

‘new’ is instance method of class Class. Classes in Ruby are first-class objects—each is an instance of class Class.When a new class is defined (typically using class SomeName … end), an object of type Class is created and assigned to a constant (SomeName, in this case)…

View original post 460 more words