Code Monkey home page Code Monkey logo

Comments (4)

notahat avatar notahat commented on July 29, 2024

Hmmm, not sure. It'd be a mess to implement on top of the current named blueprints and caching mechanism.

I'd rather find some way to pass stuff like this in as extra arguments, but I'm not sure how to fit that in with the existing arguments to make.

from machinist.

pezra avatar pezra commented on July 29, 2024

Are you thinking something like:

Post.blueprint(:with_comments, :blueprint_params => [:num_comments]) do |params|
  # ...
  comments(params[:num_comments].to_i)
end

Post.make(:with_comments, :num_comments => 3)

That syntax for making the objects feels less clear to me. Keeping pecs/tests as clear and concise as possible is paramount for me. However, having this functionality is more important than the syntax. If you have a strong preference i am open to implementing that.

I haven't looked at the internals of the caching mechanism yet. I'll take a look soon an see if i can see an approach to caching the results of parameterized blueprints.

from machinist.

inspire22 avatar inspire22 commented on July 29, 2024

the randexp gem would work great for this, check it out

from machinist.

notahat avatar notahat commented on July 29, 2024

The caching mechanism is now gone, but this still all feels a bit too magic to me. I'd just make some nice helper methods that wrap calls to Machinist if I was doing the same thing.

That said, feel free to fork and give it a go. You may come up with something that surprises me, and even if you don't, there's no harm in having a fork that meets your needs.

Or you can always make another gem that extends Machinist. (I'm encouraging the guys working on DataMapper support to make a machinist-dm gem, for example.)

from machinist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.