HipsterStruct - new way for creating objects in Rails by makaroni4

E302c3320cd14b02cbe237b479d7f884?size=52

A colleague of mine proposed an idea for a new syntax for instantiating object in #rails:

User.create! do
  nickname = 'makaroni4'
  email = 'my_email@gmail.com'
end

As you can see there is no variable passed to a block and there is no context (self etc) inside the block. Is it possible? Under the cut there is an explanation of this case and implementation of similar syntax. More under the cut

Module with self.included - execution order by makaroni4

E302c3320cd14b02cbe237b479d7f884?size=52

Don't forget that self.included method in module is executed in the end:

module Gangster
  def self.included(base)
    puts "Inside self.included"
  end

  puts "Outside self.included"
  def shoot
    puts "Tra ta ta ta ta!"
  end
end

class Human
  include Gangster
end

# => Outside self.included
# => Inside self.included

More under the cut