Comments (3)
I tried this in JRuby with Celerity and there it works so it really seems related to the remote proxy object.
from culerity.
I can totally verify this. It happens to any Celerity::ElementCollections object using one of Culerity's remote proxy calls that uses a block argument, such as 'each'. This means that despite the fact that Celerity::ElementCollections is Enumerable, none of the Enumerable methods which take blocks work (e.g., 'detect'). I speculate that the problem is in the 'block_to_string' method in RemoteObjectProxy.rb:
def block_to_string &block
result = block.call.to_s.strip
unless result.is_a?(String) && result[/^lambda\s*({|do).+(}|end)/xm]
result = "lambda { #{result} }"
end
result.gsub("\n", ";")
end
The line "result = block.call.to_s.strip" is the problem, I speculate. For instance, in the case of the 'each' method in the example above, 'each' has yet to be sent via the send_remote method to Celerity, so it hasn't had a chance to return a link. And when block.call is executed it expects, in this case, a link object to be present and that object will have a .inspect method. However, at this point in the call chain, the link in the block is unbound, so an error occurs. In my experience, it usually says that object nil does not have a particular method name.
from culerity.
I have created a patch on my personal branch to show how this problem can be fixed.
https://github.com/chad-medi/culerity/commit/9e65312dd86e893ef86b90df39e4a2310f46a12a
The fix is pretty brutal, removing the possibility of explicitly passing a block to a remote call (of course, Ruby always allows you to pass blocks, but in this case, they are now ignored). The patch also transforms Culerity's RemoteObjectProxy to an Enumerable object, which means methods based on 'each' iteration now work. This solution is not ideal, since not all all objects returned by RemoteObjectProxy are collections that could be enumerated. A less 'hacky' patch would, I believe, require significant architectural changes to Culerity making it less of a proxy library.
from culerity.
Related Issues (20)
- Culerity fails if JRuby is not in a standard path HOT 18
- culerity.js ajax_with_count fails on async:false calls HOT 1
- Can't follow links if contained in div.buttons HOT 2
- culerity_rails_server.pid in wrong location HOT 1
- IO.popen("script/server") makes the Rails app sad HOT 7
- Culerity throws deprecation warning when calling Node#type
- Exception invoking jsxGet_length (Culerity::CulerityException HOT 3
- Nailgun support HOT 6
- "Then I should see..." steps fail if text is contained in paragraph tags and not div tags HOT 4
- step 'When I follow "[link]"' finds wrong link, with celerity -v=0.7.7 and above HOT 4
- Doctype being removed HOT 3
- browser object HOT 2
- Culerity generators in Rails 3 HOT 3
- Culerity not working with regular JRuby HOT 6
- Broken pipe with RVM (or whatever) HOT 6
- RemoteObjectProxy implements method_missing but not respond_to? HOT 2
- culerity hangs on exit HOT 3
- Culerity, Capybara and Ruby 1.9.2
- Culerity integration link is stale HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from culerity.