ide gem under ruby 2.1.2

I am trying to install the ruby-debug-ide gem under ruby 2.1.2 . This to debug in Rubymine. It worked for ruby1.9.3 but not for this version. here is the error: 1.3.5/lib/debugger/ruby_core_source/ruby-2.1.2-p95/***internal.h:209: error: expected ‘;’, ‘,’ or ‘)’ before ‘x’*** Here is the output. I would love the ability to make sence or debug this in some way . A quick fix will also be g

红宝石2.1.2下的ide宝石

我试图在ruby 2.1.2下安装ruby-debug-ide gem。 这在Rubymine中进行调试。 它适用于ruby1.9.3,但不适用于此版本。 这里是错误: 1.3.5/lib/debugger/ruby_core_source/ruby-2.1.2-p95/***internal.h:209: error: expected ‘;’, ‘,’ or ‘)’ before ‘x’*** 这是输出。 我希望能够以某种方式进行思考或调试。 快速解决方案也会很棒:-) Fetching: ruby-debug-ide-0.4.22.gem (100%) Building native extensions. This

Limiting heap size for a Ruby process does not work

I would like to limit the heap size available for a Ruby process, ie if the process tries to grab more heap, it should abort. The Ruby process is called from a zsh. To test the concept, I did the following: Inside my Ruby program, I calculate the heap size using the following function: def heap_size GC.stat[:heap_length] * # Number of pages GC::INTERNAL_CONSTANTS[:HEAP_OBJ_LIMIT] * #

限制Ruby进程的堆大小不起作用

我想限制Ruby进程可用的堆大小,即如果进程试图获取更多堆,它应该中止。 Ruby进程是从zsh调用的。 为了测试这个概念,我做了以下工作: 在我的Ruby程序中,我使用以下函数计算堆大小: def heap_size GC.stat[:heap_length] * # Number of pages GC::INTERNAL_CONSTANTS[:HEAP_OBJ_LIMIT] * # Number of slots in one page GC::INTERNAL_CONSTANTS[:RVALUE_SIZE] # Size of one slots in bytes end 通过为该程

rescue In a rake Task?

I'm trying to use pry-rescue inside of a rake task. Something like this: bundle exec rescue rake my:task But when an exception occurs ( undefined method... ) it just exists like normal. How can I use pry-rescue with my rake task? 你有没有尝试将你的任务物体包裹在救援区? task 'my_task' do Pry.rescue { things.that_need_doing } end

救援在耙子任务?

我试图在耙子任务中使用撬棒救援。 像这样的东西: bundle exec rescue rake my:task 但是,当发生异常( undefined method... )它就像正常一样存在。 我如何使用我的耙子任务使用撬棒救援? 你有没有尝试将你的任务物体包裹在救援区? task 'my_task' do Pry.rescue { things.that_need_doing } end

How can I make simple http requests within a ruby Shoes GUI application?

I'm trying to make a simple http request to a local rails application running at localhost:3000. The code for my application is very much in prototype phase as I am only trying to get raw functionality before I try anything else. The rails app simply returns JSON that looks like this before being parsed "{"response":"foo is blank"}" Here's the code I'm trying right now: require

如何在ruby Shoes GUI应用程序中创建简单的http请求?

我试图对localhost:3000上运行的本地rails应用程序发出一个简单的http请求。 我的应用程序的代码在原型阶段非常多,因为我只尝试在尝试其他任何事情之前获取原始功能。 rails应用程序只是在分析之前返回看起来像这样的JSON "{"response":"foo is blank"}" 以下是我现在正在尝试的代码: require 'net/http' def get_response return Net::HTTP.get(URI.parse("http://localhost:3000")) end Shoes.app(:width => 28

How can I make a simple text editing application in Shoes?

I am trying to write a simple tool using Shoes. This will indent code for an obscure scripting language we use. It has one large text box and one button. I have the program working on the command line, but am having no luck wrapping this up in Shoes. If anyone could give a working example of an app that does the following tasks to get me up and running that would be very useful. When the bu

我如何在鞋上制作一个简单的文本编辑应用程序?

我正在尝试使用Shoes编写一个简单的工具。 这将缩进我们使用的一种模糊的脚本语言的代码。 它有一个大文本框和一个按钮。 我的程序在命令行上运行,但没有运气在鞋子里包装。 如果任何人都可以举一个应用程序的工作示例,执行以下任务来启动并运行,这将非常有用。 当按钮被点击时,我想:获取文本,分割成一行数组(缩进发生在这里),再次连接这些行并使用新数据刷新文本框。 Shoes.app :width => 300, :height =>

control flow in ruby fiber program

I know that fibers are cooperative threads. A fiber has control of the execution context, whereas a preemptive thread does not. A fiber can yield control, which means a fiber can start and stop in well-defined places. Apparently, the reason why fibers are used in evented ruby is to clean up the nested blocks caused by the reactor pattern. But I have difficulty trying to grasp the control fl

控制红宝石纤维流程

我知道纤维是合作的线程。 光纤具有对执行上下文的控制权,而抢先式线程不具有控制权。 光纤可以产生控制,这意味着光纤可以在明确的位置开始和停止。 显然,为什么光纤用于均匀的红宝石的原因是为了清理由反应堆图案引起的嵌套块。 但是我很难掌握下面使用光纤的脚本的控制流程。 def http_get(url) f = Fiber.current http = EventMachine::HttpRequest.new(url).get # resume fiber once http call is done ht

How does one achieve parallel tasks with Ruby's Fibers?

I'm new to fibers and EventMachine, and have only recently found out about fibers when I was seeing if Ruby had any concurrency features, like go-lang. There don't seem to be a whole lot of examples out there for real use cases for when you'd use a Fiber. I did manage to find this: https://www.igvita.com/2009/05/13/fibers-cooperative-scheduling-in-ruby/ (back from 2009!!!) which

如何用Ruby的Fibers实现并行任务?

我是光纤和EventMachine的新手,最近才发现有关光纤的信息,看看Ruby是否有任何并发​​功能,比如go-lang。 当你使用光纤时,似乎没有太多的实例用于实际使用情况。 我设法找到了这个:https://www.igvita.com/2009/05/13/fibers-cooperative-scheduling-in-ruby/(从2009年起回来!!!) 其中包含以下代码: require 'eventmachine' require 'em-http' require 'fiber' def async_fetch(url) f = Fiber.current http =

Why do people say that Ruby is slow?

I like Ruby on Rails and I use it for all my web development projects. A few years ago there was a lot of talk about Rails being a memory hog and about how it didn't scale very well but these suggestions were put to bed by Gregg Pollack here. Lately though, I've been hearing people saying that Ruby itself is slow. Why is Ruby considered slow? I do not find Ruby to be slow but then

为什么人们说Ruby比较慢?

我喜欢Ruby on Rails,并将其用于我的所有Web开发项目。 几年前,有很多关于Rails是一个记忆猪的话题,以及它如何不能很好地扩展,但这些建议是由Gregg Pollack 在这里放置的。 但最近我听到有人说Ruby本身很慢。 为什么Ruby认为缓慢? 我没有发现Ruby会很慢,但是,我只是用它来制作简单的CRUD应用程序和公司博客。 在我发现Ruby变慢之前,我需要做什么类型的项目? 或者,这种缓慢只是影响所有编程语言的东西? 如

Why does Ruby use its own syntax for safe navigation operator?

Ruby 2.3.0 introduces the safe navigation syntax that eases the nil handling of chained method calls by introducing a new operator that only calls the method if value of previous statement is not nil. This is a feature that already exists for example in C#, Groovy and Swift. For example in Groovy, the syntax is foo?.bar which basically means that the result value is that of foo.bar unless foo

为什么Ruby使用自己的语法来安全导航运算符?

Ruby 2.3.0引入了安全导航语法,通过引入一个只在前一个语句的值不为零时才调用该方法的新运算符来简化链处理方法调用的零处理。 这是一个在C#,Groovy和Swift中已经存在的功能。 例如在Groovy中,语法是 foo?.bar 这基本上意味着结果值是foo.bar的结果值,除非foo为null,在这种情况下,返回值也是null,因此不会引发异常。 此外,C#(称为空条件运算符)和Swift(称为可选链表达式)使用此表示法。 所以这个语法在其

Ruby stubbing with faraday, can't get it to work

Sorry for the title, I'm too frustrated to come up with anything better right now. I have a class, Judge , which has a method #stats . This stats method is supposed to send a GET request to an api and get some data as response. I'm trying to test this and stub the stats method so that I don't perform an actual request. This is what my test looks like: describe Judge do describ

与法拉第的红宝石残肢,不能让它工作

对不起,我太沮丧了,现在想出更好的东西。 我有一个课, Judge ,它有一个方法#stats 。 这个stats方法应该向api发送一个GET请求并获取一些数据作为响应。 我试图测试这个和存根统计方法,以便我不执行实际的请求。 这是我的测试看起来像: describe Judge do describe '.stats' do context 'when success' do subject { Judge.stats } it 'returns stats' do allow(Faraday).to receive(:get