Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #4283

Re: Scope problem (?) in implementing Design Patterns in Ruby

From David Jacobs <developer@wit.io>
Newsgroups comp.lang.ruby
Subject Re: Scope problem (?) in implementing Design Patterns in Ruby
Date 2011-05-11 13:37 -0500
Organization Service de news de lacave.net
Message-ID <BANLkTimYrbAg4fmj0MjHTeRcHRAy4Wo-Vw@mail.gmail.com> (permalink)
References <7e6155b0-8d33-4677-87ec-be2c3f0fca97@b7g2000prg.googlegroups.com> <BANLkTi=U0vNmLikh+69DWKX=LLwKOGS2Eg@mail.gmail.com>

Show all headers | View raw


[Note:  parts of this message were removed to make it a legal post.]

One more suggestion: if you're going to build a hierarchy, might as well
work the parent as much as possible. My final implementation would probably
look something like this:

http://www.pastie.org/1889969

On Wed, May 11, 2011 at 1:51 PM, David Jacobs <developer@wit.io> wrote:

> I think the second link points to the wrong pastie.
>
> I can see a couple of problems with the code, first of which is that you
> are setting up Expression.new to require an argument but not passing it an
> argument when you call All_basic.new, etc.
>
> More than design patterns (which I think are a little much here), I would
> suggest looking into Ruby's higher order functions like reduce and map. They
> make your code a lot simpler. This is an alternate implementation I did. Let
> me know what you think:
>
> http://www.pastie.org/1889838
>
> On Wed, May 11, 2011 at 1:20 PM, RichardOnRails <
> RichardDummyMailbox58407@uscomputergurus.com> wrote:
>
>> Hi,
>>
>> I'm hoping that employing "Design Patterns in Ruby" will lead to less
>> coding errors and more easily maintained code.  I'm stuck with the Not
>> pattern in the File Finding pattern in Chapter 15.
>>
>> I've posted my code and output in http://www.pastie.org/1889586 and
>> http://www.pastie.org/188968, respectively.  Any idea about the cause
>> of the reported syntax error?
>>
>> Thanks in Advance,
>> Richard
>>
>>
>

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Scope problem (?) in implementing Design Patterns in Ruby RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-05-11 10:15 -0700
  Re: Scope problem (?) in implementing Design Patterns in Ruby David Jacobs <developer@wit.io> - 2011-05-11 12:52 -0500
    Re: Scope problem (?) in implementing Design Patterns in Ruby David Jacobs <developer@wit.io> - 2011-05-11 12:53 -0500
    Re: Scope problem (?) in implementing Design Patterns in Ruby David Jacobs <developer@wit.io> - 2011-05-11 13:37 -0500
      Re: Scope problem (?) in implementing Design Patterns in Ruby RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-05-11 18:07 -0700
    Re: Scope problem (?) in implementing Design Patterns in Ruby RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-05-11 17:30 -0700
  Re: Scope problem (?) in implementing Design Patterns in Ruby 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-11 14:28 -0500
    Re: Scope problem (?) in implementing Design Patterns in Ruby 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-11 15:23 -0500
      Re: Scope problem (?) in implementing Design Patterns in Ruby David Jacobs <developer@wit.io> - 2011-05-11 15:26 -0500
        Re: Scope problem (?) in implementing Design Patterns in Ruby 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-11 15:45 -0500
      Re: Scope problem (?) in implementing Design Patterns in Ruby 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-11 15:34 -0500
        Re: Scope problem (?) in implementing Design Patterns in Ruby David Jacobs <developer@wit.io> - 2011-05-11 15:48 -0500
          Re: Scope problem (?) in implementing Design Patterns in Ruby RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-05-12 08:59 -0700
            Re: Scope problem (?) in implementing Design Patterns in Ruby David Jacobs <developer@wit.io> - 2011-05-12 20:56 -0500
              Re: Scope problem (?) in implementing Design Patterns in Ruby 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-12 21:11 -0500
                Re: Scope problem (?) in implementing Design Patterns in Ruby David Jacobs <developer@wit.io> - 2011-05-12 21:18 -0500
              Re: Scope problem (?) in implementing Design Patterns in Ruby RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-05-13 00:28 -0700
                Re: Scope problem (?) in implementing Design Patterns in Ruby David Jacobs <developer@wit.io> - 2011-05-13 09:46 -0500
                Re: Scope problem (?) in implementing Design Patterns in Ruby RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-05-13 10:55 -0700
                Re: Scope problem (?) in implementing Design Patterns in Ruby 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-13 12:50 -0500
                Re: Scope problem (?) in implementing Design Patterns in Ruby Steve Klabnik <steve@steveklabnik.com> - 2011-05-13 13:14 -0500
                Re: Scope problem (?) in implementing Design Patterns in Ruby RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-05-23 19:24 -0700
              Re: Scope problem (?) in implementing Design Patterns in Ruby RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-05-24 20:33 -0700
                Re: Scope problem (?) in implementing Design Patterns in Ruby David Jacobs <developer@wit.io> - 2011-05-25 17:30 -0500
                Re: Scope problem (?) in implementing Design Patterns in Ruby RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-05-27 22:08 -0700
  Re: Scope problem (?) in implementing Design Patterns in Ruby 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-12 21:20 -0500
    Re: Scope problem (?) in implementing Design Patterns in Ruby David Jacobs <developer@wit.io> - 2011-05-12 21:26 -0500
  Re: Scope problem (?) in implementing Design Patterns in Ruby Ryan Davis <ryand-ruby@zenspider.com> - 2011-05-13 12:29 -0500

csiph-web