vhaerun 0 Newbie Poster

hi guys !

I'm kinda new to ruby , and was wondering about the following stuff ,
assume the following code :

Shoes.app {
  button("Press Me") { alert("You pressed me") }
}

how could I write code like that , so that when I call a method like
button , I don't have to put an object or a class name in front of it .

To give another example , let's assume the following code :

class Whatever
   attr_accessor :value

   def initialize
      yield self
   end

   def some_method
      puts "some method"
   end

end

I would like to do the following ( if it's possible ) :

w = Whatever.new do |whatever|
        some_method
        value = 20
end
puts w.value # this should output 20

Is this possible , without adding those methods to Object ?

Thank you very much!