Coder Social home page Coder Social logo

nest's Issues

Issues when running with Activesupport

Activesupport overrides Object#to_json so that it calls Object#as_json. The latter however looks for to_hash method and if not found just grabs all the instance variables. This leads to Nest.initialize('foo').to_json returning a ton of garbage instead of a key, because it also appends @rc

The issue can be solved by adding Nest#to_json explicitly so that it does to_s.to_json for example

UPD: this won't work. The solutions are to add Nest#to_hash or Nest#as_json to return @ns, both of which being kinda meh since it's not really a hash...

This is ok for a monkeypatch workaround though =)

Add some extensions

I'm not sure where did I copy these extensions from, perhaps redis-ruby. These extensions let nest use hash directly. I find them very useful. Do you think we can add them to the gem?

Nest.class_eval do
  def mapped_hmget(*fields)
    Hash[**hmget(*fields)]
  end

  def mapped_hgetall
    Hash[*hgetall]
  end

  def mapped_hmset(values)
    hmset(*values.to_a.flatten)
  end
end

Use method missing instead of just call?

I think the old interface is what make nest great. Instead of sterilze this to only "call" I think we'd better use method missing instead. The syntax error still propagate through RuntimeError exception What do you say?

addition of method_missing without to_ary breaks ohm

A test app with ohm 3.1.1 and nest 3.1.0 (ruby 2.3.1p112) fails on Ohm::Model#find:

TypeError: can't convert Nest to Array (Nest#to_ary gives RuntimeError)
	ohm-3.1.1/lib/ohm.rb:1480:in `flatten'

This may be related to an interaction between method_missing and flatten discussed here. I did not write tests, but cargo-culting the solution applied to bundler there also appeared to solve the problem for nest:

private
def to_ary
  nil
end

Thanks!

Passing blocks to Redis and 1.8.6

I've just run into the issue on Ruby 1.8.6 where define_method doesn't recognize block arguments. You can read more here

I've tried every combo I can think of to patch this up and nothing really seems to work well. class_eval results in stack level too deep and I'm not sure how far down the rabbit hole I want to go on this one.

If you guys have any idea, I'd love to hear it. Obviously "use 1.8.7 or higher" is a valid answer ;)

nest is returning interfered result in thin

nest.get is returning result of different redis query (like a redis set, or of different key) when running in thin.

When I switch from nest to the regular redis-rb, the issue go away.

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.