Code Monkey home page Code Monkey logo

little-boxes's People

Contributors

jesuspc avatar manuelmorales avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

little-boxes's Issues

Possible alternative DSL

I really like the idea of lazy evaluations and initialization.

But I am not sure that the vocabulary borrowed from RSpec ("let") sits with me well.

What if you could just use the words lazy and eager instead of let and eager?

And letc I would propose to merge with let (and replace by eager/lazy), and instead of the current dependency use depends or inject. This would better express that lazy/eager is for defining a dependency that will be used elsewhere, while depends or inject is for expressing a dependency on the externally defined object.

Also, instead of receiving box as an argument, perhaps the lambda can be run as instance_exec from the box itself, so that you don't need to provide box. and can just type this:

class MyApp::MainBox
  include LittleBoxes::Box

  lazy(:redis) do
    require 'redis'
    Redis.new
  end

  eager(:publisher) do # no parameter, because evaluated inside of box.instance_exec
    Publisher.new redis: redis
  end
end

class Publisher
  include LittleBoxes::Configurable
  inject :redis
end

class MainBox
  # ...

  lazy(:publisher) { Publisher.new }
end

What is the purpose of letc and why not just always resolve dependencies? I totally get the need for lazy and eager, but I wasn't really clear why you'd need two methods to define objects in the mainbox.

Overall โ€” interesting concept and definitely worth looking into. Thanks for your work, and feel free to throw away all the suggestions. After all, naming is highly subjective if not personal :)

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::VersionConflict with message: Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    bundler (~> 1.3)

  Current Bundler version:
    bundler (2.2.15)

Your bundle requires a different version of Bundler than the one you're running.
Install the necessary version with `gem install bundler:1.17.3` and rerun bundler using `run.rb _1.17.3_`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Using nested boxes makes it difficult to override parts of those boxes in another box.

Okay, this is a mouthful

Given

class MainBox
  include LittleBoxes::Box

  box(:things) do
     let(:stuff) { "stuff" }
     let(:otherstuff) { "stuff I dont care about" }
  end
end

If I want to have a test box, that overrides stuff, I have to redefine the box like so.

class TestBox
  include LittleBoxes::Box
  import MainBox
  box(:things) do
    let(:stuff) { "teststuff" }
  end
end

box.things.othersuff is lost when using the test box. I know I can solve this by having box(:things) actually be another class, like box(:things, ThingsBox), then I coudl simple import MainBox, and replace the :things box with say, box(:things, TestThingsBox) but I was wondering if there was a better way of accomplishing this.

Ideally I'd only like to mutate (I know this is a trigger word for most) the existing box imported from MainBox.

Cheers!

Please include topic of Bundler into Readme.

Hi!

This gem and approach is amazing. I am wondering how to use it with Bundler, which typically loads all the Gemfile dependencies at start. You finish your talk with statement that it's a completely different way of writing code. Does it mean Bundler initialization in boot.rb would be replaced by loading box, and all the dependencies should be carefully distributed within box configuration structure?

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.