Regarding win 32 screenshot

V

vardhan patil

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
 
R

Roger Pack

vardhan said:
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
 
J

Jarmo Pertman

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
 
R

Roger Pack

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.
 
J

Jarmo Pertman

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top