Regarding win 32 screenshot

Discussion in 'Ruby' started by vardhan patil, Aug 4, 2010.

  1. 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
     
    vardhan patil, Aug 4, 2010
    #1
    1. Advertising

  2. vardhan patil

    Roger Pack Guest

    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/.
     
    Roger Pack, Aug 4, 2010
    #2
    1. Advertising

  3. 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 <> 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/.
     
    Jarmo Pertman, Aug 7, 2010
    #3
  4. vardhan patil

    Roger Pack Guest

    > 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/.
     
    Roger Pack, Aug 7, 2010
    #4
  5. 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 <> 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/.
     
    Jarmo Pertman, Aug 8, 2010
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aaron

    screenshot

    Aaron, Oct 5, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    610
    Scott
    Oct 6, 2004
  2. Paul Aspinall

    Click to see full size screenshot

    Paul Aspinall, Mar 20, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    323
    Brock Allen
    Mar 20, 2005
  3. antoine c.

    java applet screenshot

    antoine c., Aug 12, 2004, in forum: Java
    Replies:
    2
    Views:
    8,629
    Andrew Thompson
    Aug 13, 2004
  4. Luigi Donatello Asero

    Re: Please criticize my website.: with screenshot

    Luigi Donatello Asero, Oct 4, 2005, in forum: HTML
    Replies:
    1
    Views:
    335
    dorayme
    Oct 4, 2005
  5. Krist
    Replies:
    6
    Views:
    782
    Arne Vajhøj
    May 7, 2010
Loading...

Share This Page