Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Regarding win 32 screenshot

Reply
Thread Tools

Regarding win 32 screenshot

 
 
vardhan patil
Guest
Posts: n/a
 
      08-04-2010
Me using the latest version of gem win32screen shot..
But while taking desktop screenshot i get undefined method `call for
nil:NilClass
for capture_area in bitmap maker.rb line 159
bitmap maker.rb line 127
and screenshot.rb line 29

Plz help
 
Reply With Quote
 
 
 
 
Roger Pack
Guest
Posts: n/a
 
      08-04-2010
vardhan patil wrote:
> Me using the latest version of gem win32screen shot..
> But while taking desktop screenshot i get undefined method `call for
> nil:NilClass
> for capture_area in bitmap maker.rb line 159
> bitmap maker.rb line 127
> and screenshot.rb line 29
>
> Plz help


You need to pass it a block, like the readme examples do.

http://github.com/jarmo/win32screenshot
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Jarmo Pertman
Guest
Posts: n/a
 
      08-07-2010
Maybe using yield might be better indeed, like Roger recommended some
time ago. It seems that this named block variable doesn't help much as
i hoped. Too bad that Ruby won't throw error or show warning if named
block variables are used but no block given... for me it's like x
parameters are needed, but x-1 parameters given and there's no default
value for block so error should be shown like it is done with other
cases where more or less parameters are given to the method than
expected.

Jarmo

On Aug 4, 5:54*pm, Roger Pack <(E-Mail Removed)> wrote:
> vardhan patil wrote:
> > Me using the latest version of gem win32screen shot..
> > But while taking desktop screenshot i get undefined method `call for
> > nil:NilClass
> > for capture_area in bitmap maker.rb line 159
> > bitmap maker.rb line 127
> > and screenshot.rb line 29

>
> > Plz help

>
> You need to pass it a block, like the readme examples do.
>
> http://github.com/jarmo/win32screenshot
> --
> Posted viahttp://www.ruby-forum.com/.


 
Reply With Quote
 
Roger Pack
Guest
Posts: n/a
 
      08-07-2010
> Too bad that Ruby won't throw error or show warning if named
> block variables are used but no block given... for me it's like x
> parameters are needed, but x-1 parameters given and there's no default
> value for block so error should be shown like it is done with other
> cases where more or less parameters are given to the method than
> expected.


Yeah the only way I know of to force their use it so either use yield
(which will throw a LocalJumpError: no block given), or to raise like

raise LocalJumpError.new unless block
or
raise LocalJumpError.new unless block_given? (handle the implicit case)

I wonder if there's some other way, as well, that I don't know about.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Jarmo Pertman
Guest
Posts: n/a
 
      08-08-2010
Released version 0.0.6 where i'm using yield instead of block.call.
Hopefully it makes it more clear that block needs to be used

Jarmo

On Aug 7, 3:01*pm, Roger Pack <(E-Mail Removed)> wrote:
> > Too bad that Ruby won't throw error or show warning if named
> > block variables are used but no block given... for me it's like x
> > parameters are needed, but x-1 parameters given and there's no default
> > value for block so error should be shown like it is done with other
> > cases where more or less parameters are given to the method than
> > expected.

>
> Yeah the only way I know of to force their use it so either use yield
> (which will throw a LocalJumpError: no block given), or to raise like
>
> raise LocalJumpError.new unless block
> or
> raise LocalJumpError.new unless block_given? (handle the implicit case)
>
> I wonder if there's some other way, as well, that I don't know about.
> --
> Posted viahttp://www.ruby-forum.com/.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applet to run on Win 98, Win ME, Win XP, Win Vista & Win 7 ?? Krist Java 6 05-06-2010 11:53 PM
Bluetooth issues screenshot Bible John Wireless Networking 5 02-18-2006 12:42 AM
Screenshot of web managed switch dkotschess@yahoo.com Cisco 3 11-13-2005 12:03 AM
Click to see full size screenshot Paul Aspinall ASP .Net 1 03-20-2005 12:40 AM
screenshot Aaron ASP .Net 4 10-05-2004 11:21 PM



Advertisments