ruby

Alternatives to RMagick/ImageMagick for reading image pixel by pixel

萝らか妹 提交于 2021-01-27 12:20:43
问题 I am currently using RMagick and ImageMagick on a project I am working on, an ASCII image generator: https://github.com/ehayon/Pixie However, I don't like the ImageMagick dependency. I'm having a hard time finding an alternate library. All I need to do is get the RGB value at each pixel of an image. I'd like to support PNG and JPEG at a minimum. Anybody have experience with a similar library without the ImageMagick dependency? 回答1: Still looking for one on JPEG, but there's quite a nice

Bundler is deprecating bundle console in favor of bin/console. Can anyone provide more clarity as to how bin/console should work?

安稳与你 提交于 2021-01-27 12:01:01
问题 I have a custom ruby gem that relies heavily on bundle console . Nothing special or fancy, just an interactive console with the set of gems defined by the Gemfile included. We use the console a lot during development. Currently when I run the command, I receive the following deprecation message: [DEPRECATED] bundle console will be replaced by bin/console generated by bundle gem <name> Digging around in the bundler docs I found the following explanation: The bundle console will be removed and

Bundler is deprecating bundle console in favor of bin/console. Can anyone provide more clarity as to how bin/console should work?

戏子无情 提交于 2021-01-27 12:00:46
问题 I have a custom ruby gem that relies heavily on bundle console . Nothing special or fancy, just an interactive console with the set of gems defined by the Gemfile included. We use the console a lot during development. Currently when I run the command, I receive the following deprecation message: [DEPRECATED] bundle console will be replaced by bin/console generated by bundle gem <name> Digging around in the bundler docs I found the following explanation: The bundle console will be removed and

using a proxy with phantomjs in selenium webdriver

笑着哭i 提交于 2021-01-27 10:49:44
问题 I'm trying to configure a proxy with PhantomJS 1.9.1 in a ruby (1.8.7) script for selenium webdriver (2.25). I saw a few examples with Firefox, and I successfully did it with this browser. I used this code : profile = Selenium::WebDriver::Firefox::Profile.new profile.proxy = Selenium::WebDriver::Proxy.new :ssl => 'chronos.landebitel.local:3128' $browser = Watir::Browser.new :firefox, :profile => profile But I can't find any examples for phantomjs. I searched and tried many solutions, but none

using a proxy with phantomjs in selenium webdriver

China☆狼群 提交于 2021-01-27 10:48:24
问题 I'm trying to configure a proxy with PhantomJS 1.9.1 in a ruby (1.8.7) script for selenium webdriver (2.25). I saw a few examples with Firefox, and I successfully did it with this browser. I used this code : profile = Selenium::WebDriver::Firefox::Profile.new profile.proxy = Selenium::WebDriver::Proxy.new :ssl => 'chronos.landebitel.local:3128' $browser = Watir::Browser.new :firefox, :profile => profile But I can't find any examples for phantomjs. I searched and tried many solutions, but none

Ruby: DRY class methods calling Singleton instance methods [duplicate]

时光总嘲笑我的痴心妄想 提交于 2021-01-27 08:44:55
问题 This question already has answers here : Calling a method of a Ruby Singleton without the reference of 'instance' (5 answers) Closed 5 years ago . I have the a Singleton class ExchangeRegistry which keeps all the Exchange objects. Instead of needing to call: ExchangeRegistry.instance.exchanges I want to be able to use: ExchangeRegistry.exchanges This works, but I'm not happy with the repetition: require 'singleton' # Ensure an Exchange is only created once class ExchangeRegistry include

Ruby: DRY class methods calling Singleton instance methods [duplicate]

时间秒杀一切 提交于 2021-01-27 08:44:49
问题 This question already has answers here : Calling a method of a Ruby Singleton without the reference of 'instance' (5 answers) Closed 5 years ago . I have the a Singleton class ExchangeRegistry which keeps all the Exchange objects. Instead of needing to call: ExchangeRegistry.instance.exchanges I want to be able to use: ExchangeRegistry.exchanges This works, but I'm not happy with the repetition: require 'singleton' # Ensure an Exchange is only created once class ExchangeRegistry include

Ruby: DRY class methods calling Singleton instance methods [duplicate]

ぐ巨炮叔叔 提交于 2021-01-27 08:43:34
问题 This question already has answers here : Calling a method of a Ruby Singleton without the reference of 'instance' (5 answers) Closed 5 years ago . I have the a Singleton class ExchangeRegistry which keeps all the Exchange objects. Instead of needing to call: ExchangeRegistry.instance.exchanges I want to be able to use: ExchangeRegistry.exchanges This works, but I'm not happy with the repetition: require 'singleton' # Ensure an Exchange is only created once class ExchangeRegistry include

Ruby: DRY class methods calling Singleton instance methods [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-27 08:43:34
问题 This question already has answers here : Calling a method of a Ruby Singleton without the reference of 'instance' (5 answers) Closed 5 years ago . I have the a Singleton class ExchangeRegistry which keeps all the Exchange objects. Instead of needing to call: ExchangeRegistry.instance.exchanges I want to be able to use: ExchangeRegistry.exchanges This works, but I'm not happy with the repetition: require 'singleton' # Ensure an Exchange is only created once class ExchangeRegistry include

Pretty-print arrays on failure

℡╲_俬逩灬. 提交于 2021-01-27 08:21:29
问题 describe Rspec do it 'should print arrays in a readable manner' do arr = [ [0, :a, -1], [1, :b, -2], [2, :c, -3], [3, :d, -4], [4, :e, -5], [6, :g, -7], [7, :h, -8], [8, :i, -9] ] arr.should eql [] end end On failure: Failures: 1) Rspec should print arrays in a readable manner Failure/Error: arr.should eql [] expected: [] got: [[0, :a, -1], [1, :b, -2], [2, :c, -3], [3, :d, -4], [4, :e, -5], [6, :g, -7], [7, :h, -8], [8, :i, -9]] Is there a way to tell Rspec to pretty print its failures? My