havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com || Ruby 2.4.1, 2.3.4 & 2.2.7: https://www.ruby-lang.org || Paste >3 lines of text to: https://gist.github.com || Rails questions? Ask in: #RubyOnRails || Logs: https://irclog.whitequark.org/ruby || Books: https://goo.gl/wpGhoQ
Rodya_ has joined #ruby
Coldblackice has quit []
<allisio> In that case, `ARGV[2]` will be `nil`, and the same for `$FILE_NAME`. `File.open` expects a String.
joneshf-laptop has quit [Quit: Leaving]
fulcan has joined #ruby
nowhere_man has joined #ruby
Snickers has quit [Quit: Snickers]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_sfiguser has quit [Ping timeout: 240 seconds]
ddffg has quit [Ping timeout: 260 seconds]
jameser has joined #ruby
charliesome has joined #ruby
johnny56 has joined #ruby
_sfiguser has joined #ruby
batmaan has joined #ruby
batmaan1 has joined #ruby
sarbs has quit [Read error: Connection reset by peer]
nowhere_man has quit [Remote host closed the connection]
batmaan has quit [Ping timeout: 246 seconds]
slackR has joined #ruby
tolerablyjake has quit [Quit: Textual IRC Client: www.textualapp.com]
Xiti has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sarbs has joined #ruby
Coldblackice has joined #ruby
cyphase has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charliesome has joined #ruby
yokel has quit [Ping timeout: 246 seconds]
genpaku has quit [Ping timeout: 260 seconds]
sniffer has quit [Quit: No Ping reply in 180 seconds.]
genpaku has joined #ruby
yokel has joined #ruby
GodFather has quit [Ping timeout: 256 seconds]
vikaton has quit [Quit: Connection closed for inactivity]
bkxd has joined #ruby
jdm has quit [Remote host closed the connection]
sniffer has joined #ruby
bkxd has quit [Ping timeout: 268 seconds]
bkxd has joined #ruby
<acalycine> Anybody use Nokogiri?
<allisio> Loads of people use Nokogiri.
<acalycine> I want to fetch the first result (from top to bottom) on the page, atm I'm using #scan.
<acalycine> Right. So line 6 in this: https://gist.github.com/anonymous/b3e6167d8e9a2590bc164b7a0f024982 would have a ".first" at the end of it?
thatsnotjack has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jdm has joined #ruby
<allisio> You said you were using Nokogiri.
<allisio> Implied that, anyway.
batmaan1 has quit [Ping timeout: 260 seconds]
agent_white has joined #ruby
<acalycine> Huh? That is Nokogiri.
<allisio> That's not Nokogiri. That's using regular expressions to parse HTML.
<acalycine> Oh...
<acalycine> Is there any way to do it using regex then?
gix has quit [Ping timeout: 260 seconds]
<Verity> that got it, ty
zipace has joined #ruby
<acalycine> Doesn't the regex already have the nongreedy thing on it? "(.*?)"
d^sh has quit [Ping timeout: 260 seconds]
ziprar has quit [Ping timeout: 240 seconds]
<allisio> Yeah, but you're using #scan. Seems like you probably want #match instead.
<allisio> Or even just String#[](Regexp), if you're feeling frisky.
<Verity> is there really any point in even havingb this base class and deriving fro it
<allisio> No.
gix has joined #ruby
<allisio> acalycine: That is, you could say `viewgames[/.../]`, and then $1 would contain the relevant game ID.
<acalycine> Ah.
d^sh has joined #ruby
<acalycine> As the regex?
johnzorn has quit [Read error: Connection reset by peer]
johnzorn has joined #ruby
<Verity> allisio, should I put the SOH, ACK etc inside the class, alsong with the COMMAND = ARGV[1] etc
libastral has quit [Ping timeout: 260 seconds]
libastral has joined #ruby
<allisio> Verity: If you'll pardon my candor, I think you've picked an awful project for your first foray into Ruby.
<acalycine> Not like `matches = viewgames.match(/.../)[0]`, right? Because that gives "<!D".
KnownSyntax has quit [Ping timeout: 264 seconds]
<allisio> It's certainly the sort of thing Ruby could be made to do and do well, but it's not a great candidate for a beginner exercise that would serve as a proper on-ramp into the language.
slackR has quit [Quit: Leaving]
<allisio> It's nasty and low-level and not well-suited to object-orientation.
KnownSyntax has joined #ruby
KnownSyntax has joined #ruby
KnownSyntax has quit [Changing host]
<Verity> I'm making progress though
<Verity> and I'm learning ruby =D
<allisio> Grueling progress, but kudos to you for sticking with it.
jameser has joined #ruby
<acalycine> allisio: I'm still not sure what you mean by `viewgames[/.../]`
<allisio> acalycine: What's unclear?
houhoulis has joined #ruby
chouhoulis has joined #ruby
<acalycine> How to implement it.
<allisio> Do you know why you're using parentheses in your regex?
<acalycine> To put the actual regex in?
<allisio> Wat.
<acalycine> `.scan(Regex)`
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<allisio> The parentheses in your regex.
<allisio> Do you know where your regex is?
<acalycine> Between the / /
chouhoulis has quit [Ping timeout: 240 seconds]
<acalycine> parentheses split it up into groups like [0] don't they?
<acalycine> capturing groups
jameser has joined #ruby
jameser has quit [Client Quit]
endemic has quit [Quit: Leaving.]
agent_white has quit [Read error: Connection reset by peer]
<allisio> acalycine: Referencing into the results of a #scan with `[0]` will give you the first of potentially many matches, not the contents of a capture group.
<allisio> But yes, parentheses in regexen are for delineating capturing groups, and you only need the one that pulls out the game ID.
<acalycine> Yes.
<allisio> You can just swap out Line 6 for the one I gave you, and then the game ID will be in the `$1` "pseudo-global" variable.
agent_white has joined #ruby
<allisio> You could also do `viewgames ~= /.../` with a named capturing group to automagically introduce a `gameid` local variable, but you probably shouldn't.
jameser has joined #ruby
thatsnotjack has quit [Ping timeout: 260 seconds]
<acalycine> `matches = viewgames[/.../]` is what you gave me, right?
<acalycine> That, by itself, results in "<!D"
<acalycine> How is it referencing `team`, the user input?
xall has joined #ruby
zel has joined #ruby
<acalycine> The original line 6 uses `#{team}` to do so.
Satyajit has joined #ruby
zel is now known as Guest60045
<allisio> Why do you have or even want a variable called `matches` when your intent is to have just the one?
<allisio> Put your regex in the hole, silly.
ElSif has joined #ruby
<acalycine> That's not really that much of an issue though, is it?
<acalycine> How is that regex referencing the `team` variable?
<acalycine> `viewgames[/../][1]` should produce the gameid according to you, I understand.
swemoney has joined #ruby
duderonomy has joined #ruby
<allisio> That's simply not what I said.
<acalycine> OK, so what are you saying?
<acalycine> That's what I have.
allisio has quit [Read error: Connection reset by peer]
spicerack has joined #ruby
spicerack has quit [Max SendQ exceeded]
HoierM has quit [Ping timeout: 256 seconds]
<Verity> how can I handle the case of the user entering an invalid filename (file that doesnt exist)
<Verity> with my own error message
<Verity> and a graceful exit
allisio has joined #ruby
<allisio> acalycine: https://eval.in/766204
<allisio> &ri File#exists?
<`derpy> No results
<allisio> Derp.
<allisio> &ri File.exists?
<allisio> You can use Kernel#warn to conveniently write to stderr, and then just `exit 1` to indicate that your program didn't execute "as expected".
GodFather has joined #ruby
<allisio> Probably you're tempted to just try to open whatever the user provides and catch the ENOENT exception, but don't.
<Verity> this exist? method is clean, it works great
<Verity> now I can handle the case of non-existing file
<acalycine> With that code I still get an unexpected result. The game ID I want from the webpage is "1148", but I get "1139" from that.
<acalycine> If you look on the webpage, I want the ID from "Brisbane vs Essendon", rather than "Gold Coast vs Brisbane".
jdm has quit [Remote host closed the connection]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
HoierM has joined #ruby
thistle has joined #ruby
<swemoney> I'm not sure where else to ask this. Does anyone know a way to log in to the amazon developer dashboard (developer.amazon.com) via ruby? I've been playing with Mechanize and Watir for a while without a lot of success. Any time I submit the login form I get redirected back to the login page. I feel like it's a cookie issue.
zipace has quit [Ping timeout: 240 seconds]
armyriad has quit [Ping timeout: 260 seconds]
armyriad has joined #ruby
gloscombe_ has quit [Quit: gloscombe_]
swemoney has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
spicerack has joined #ruby
GodFather has quit [Ping timeout: 256 seconds]
Rodya_ has quit [Remote host closed the connection]
GodFather has joined #ruby
<Verity> if valid_commands.include? command != true
<Verity> what is wrong with this
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
houhoulis has quit [Remote host closed the connection]
madgoat has joined #ruby
<allisio> Verity: You're being bitten by precedence.
<allisio> The fix for that is always parentheses.
<allisio> It's being parsed as `valid_commands.include?(command != true)`.
<allisio> Just say `if valid_commands.include? command`.
madgoat has left #ruby [#ruby]
GodFather has quit [Ping timeout: 256 seconds]
GodFather has joined #ruby
segy has quit [Quit: ZNC - http://znc.in]
charliesome has joined #ruby
duckpupp1 has joined #ruby
swemoney has joined #ruby
<acalycine> allisio: your code doesn't work.
<allisio> acalycine: Use this regex instead: /GameID=(\d+)">[^>]+> #{team}/
<allisio> It's brittle as fuck, but it'll work unless and until they change their HTML slightly.
<acalycine> Shit, thanks. That works.
<allisio> I'm too inebriated to be interested in explaining why it works, but you're welcome.
segy has joined #ruby
kegster has quit [Ping timeout: 258 seconds]
kegster has joined #ruby
duckpupp1 has quit [Ping timeout: 256 seconds]
GodFather has quit [Quit: Ex-Chat]
GodFather has joined #ruby
<allisio> swemoney: It's probably a cookie issue, but try the low-hanging fruit of sending along a sufficiently "real browser"-like User-Agent header.
<swemoney> allisio: thanks. I've tried changing the user agent. sadly, no change.
agent_white has quit [Quit: leaving]
<allisio> swemoney: What you've usually gotta do in situations like this is "physically" visit the login page, put whatever cookies that nets you in the jar, then send those along with the actual login request.
GodFather has quit [Read error: No route to host]
chouhoulis has joined #ruby
<swemoney> allisio I'm looking into checking that now. When I use Mechanize, I get a session_id and session_id_time cookie.. I feel like there should be others that are probably set via javascript or something.
<swemoney> I would think using watir with phantomjs would allow for those javascript cookies, thou
<allisio> swemoney: That may well be so, in which case you'll have to get your hands dirty and look at what all's being sent along with "real" login requests.
<allisio> But yeah, that's the sort of thing PhantomJS is intended to make painless, so :/.
<swemoney> allisio cool.. thanks. I'll keep cracking at it. Was hoping there was a wheel somewhere I didn't have to reinvent. I don't understand why Amazon doesn't have a reporting API for their mobile ads reports.
<allisio> swemoney: A nifty trick is to open your browser's developer console (F12, usually), make the request, right-click it and "Copy as cURL", then figure out exactly how much of the noise you need to send along to pass inspection.
rakm has joined #ruby
gix has quit [Ping timeout: 264 seconds]
aryaching has quit [Ping timeout: 264 seconds]
gix has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
antgel has joined #ruby
MichaelSmith_ has joined #ruby
<MichaelSmith_> Can we all agree on one thing?
<allisio> Yes, that we can all agree on one thing.
icyphox has joined #ruby
<icyphox> system "curl -F 'file=#{strone}' https://0x0.st"
<icyphox> why does this cause a segfault?
antgel has quit [Ping timeout: 256 seconds]
aryaching has joined #ruby
<allisio> Post the dump.
<icyphox> I'm unpacking an ARGV into a variable called one, and then converting that variable to a string (stored in strone), using to_s
<allisio> We burn people for variable names like that around here.
<allisio> You should go.
<icyphox> allisio: There really isn't any dump. It just says 'Segmentation Fault'.
<icyphox> Hey I'm sorry, I just started Ruby yesterday.
<MichaelSmith_> You don't have set faults in ruby this isn't c
<icyphox> Huh
<MichaelSmith_> Segmentation faults don't exist in ruby
<MichaelSmith_> Ruby is a duck typed language
<allisio> That's not quite true.
<MichaelSmith_> It's also object oriented
<allisio> >> require 'fiddle'; Fiddle::Pointer.new(1)[1]
<ruby[bot]> allisio: # => /tmp/execpad-8d7851d90e7c/source-8d7851d90e7c:2: [BUG] Segmentation fault at 0x000002 ...check link for more (https://eval.in/766229)
<icyphox> MichaelSmith_: https://0x0.st/vlH.png
<icyphox> here's a screenshot.
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<MichaelSmith_> That's a c thing
<allisio> But ruby[bot] is a Ruby evaluator.
<icyphox> Okay, fine. But why's it showing up? That's all that code I have.
<icyphox> I mean, I don't know what's my mistake here.
<MichaelSmith_> Wait so is ruby like C but for retards?
<MichaelSmith_> Because that would explain everything about segfault
<allisio> You okay, bud?
<allisio> Let's talk about what's on your mind.
<icyphox> Let's not.
<icyphox> Let's talk about why my code's wrong.
<MichaelSmith_> Well, I have lots of stuff on my mind. Like Hitler was wrong about lots of stuff, but he was right about Jews.
<havenwood> !troll MichaelSmith_
MichaelSmith_ was kicked from #ruby by ruby[bot] [trolling is a bannable offense, see http://ruby-community.com/pages/user_rules]
<allisio> I considered calling him out from the first, but there was some hope that my answering his trollish question with a paradox would fry his circuitry.
<icyphox> Now that that's out of the way...
<havenwood> icyphox: Gist the contests of test1.rb?
<havenwood> icyphox: gist.github.com
<icyphox> I know lol.
<havenwood> contents*
vali has joined #ruby
pytuger has joined #ruby
<havenwood> icyphox: It doesn't answer your question, but Curb and Typhoeus are both very nice Ruby libcurl wrappers.
<icyphox> I see.
xall_ has joined #ruby
xall has quit [Ping timeout: 258 seconds]
<havenwood> icyphox: Alternatively, shell out with Kernel#` (backticks) instead of Kernel#system.
Phage has quit [Ping timeout: 268 seconds]
sebd has quit [Ping timeout: 260 seconds]
modin has quit [Ping timeout: 260 seconds]
tjvc_ has quit [Ping timeout: 260 seconds]
sebd has joined #ruby
ElderFain has quit [Ping timeout: 268 seconds]
raatiniemi has quit [Ping timeout: 260 seconds]
Takumo has quit [Ping timeout: 260 seconds]
raatiniemi has joined #ruby
twistedpixels_ has quit [Ping timeout: 258 seconds]
<icyphox> havenwood: I don't quite know what that is. Mind ELI5ing?
ElderFain has joined #ruby
chouhoulis has quit [Remote host closed the connection]
twistedpixels_ has joined #ruby
<havenwood> icyphox: Or Ruby ships with net/http, and a net/http wrapper called open-uri that just does simple GET requests that you could use here.
tjvc has joined #ruby
tjvc has joined #ruby
tjvc has quit [Changing host]
<havenwood> icyphox: Try both of these is irb/pry:
<icyphox> yeah, I know about that, but that's not what I need here.
<havenwood> system 'ls'
<havenwood> `ls`
<icyphox> Huh whoa.
Phage has joined #ruby
Phage has joined #ruby
Phage has quit [Changing host]
<icyphox> running `ls` did something very weird.
Axy has joined #ruby
tristanp has quit [Read error: Connection reset by peer]
<havenwood> icyphox: Try: puts `ls`
TomyLobo2 has quit [Ping timeout: 264 seconds]
<allisio> I have my suspicions.
bronson has quit [Read error: Connection reset by peer]
<icyphox> Ah, that worked.
tristanp has joined #ruby
Takumo has joined #ruby
Takumo has joined #ruby
Takumo has quit [Changing host]
pytuger has quit [Ping timeout: 246 seconds]
<havenwood> icyphox: HTTP.rb is one of many nice HTTP libraries in Ruby. It has a nice API. You can POST a form like: HTTP.post('https://icyphox', form: {foo: 42})
bronson has joined #ruby
<icyphox> havenwood: Okay so I tried doing my curl command using the backticks.
WebDawgII has quit [Ping timeout: 268 seconds]
<icyphox> It started working fine, and then segfaulted again.
<havenwood> icyphox: no segfault?
Silthias has joined #ruby
<havenwood> heh
Silthias1 has quit [Ping timeout: 260 seconds]
<icyphox> Is it something wrong with my Ruby version?
Psy-Q has quit [Ping timeout: 260 seconds]
uxp has quit [Read error: Connection reset by peer]
j416 has quit [Ping timeout: 268 seconds]
uxp has joined #ruby
<havenwood> icyphox: For starters: ARGV.to_s #=> "[]"
xall_ has quit [Ping timeout: 268 seconds]
Mia has quit [Ping timeout: 268 seconds]
<havenwood> icyphox: Array#to_s isn't what you're actually wanting.
Psy-Q has joined #ruby
j416 has joined #ruby
WebDawg has joined #ruby
<icyphox> havenwood: Oh alright.
DarthGandalf has quit [Remote host closed the connection]
nemesit|znc has quit [Ping timeout: 260 seconds]
artmann_ has quit [Quit: No Ping reply in 180 seconds.]
DarthGandalf has joined #ruby
Prira has quit [Remote host closed the connection]
kies has quit [Ping timeout: 240 seconds]
rotty_ has quit [Ping timeout: 260 seconds]
artmann_ has joined #ruby
LiquidInsect has quit [Ping timeout: 260 seconds]
moufl has quit [Ping timeout: 260 seconds]
LiquidInsect has joined #ruby
HoierM has quit [Ping timeout: 240 seconds]
nemesit|znc has joined #ruby
rotty_ has joined #ruby
moufl has joined #ruby
Prira has joined #ruby
kies has joined #ruby
<icyphox> havenwood: nope, still gives me a segfault.
zacts has quit [Quit: WeeChat 1.7]
jameser has joined #ruby
<havenwood> icyphox: It's not hard to post a form with net/http and uri in the stdlib. Maybe do that instead of shelling out. Your curl command isn't right as you have it.
<havenwood> icyphox: see the "POST form request" section
zacts has joined #ruby
pytuger has joined #ruby
pytuger has quit [Changing host]
pytuger has joined #ruby
millerti has quit [Read error: Connection reset by peer]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
<havenwood> icyphox: TL;DR: Net::HTTP.post_form URI.parse('http://example.com'), {'q' => 'My query'}
<icyphox> Okay, I'll look it up.
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<matthewd> FWIW, that looks like it's curl that's segfaulting
nofxxxx has quit [Ping timeout: 260 seconds]
rakm has joined #ruby
<swemoney> allisio hah. I think I figured it out. I found a javascript call which set an amznTest cookie to test if cookies were enabled. When I set that cookie manually before submitting the login, it appears to go through.
rakm has quit [Client Quit]
rakm has joined #ruby
efffe has joined #ruby
<efffe> how can i install locally the exact gemfile.lock gems instead of `bundle install` installing the latest of a particular gem (and being out of sync with the rest of team).
<efffe> docs insinuate `bundle install` goes by whatever gemfile.lock is (unless it hasn't been generated yet)
<efffe> but after a fresh clone of a project a co-worker is working on, and `bundle install`, gemfile.lock is different.
govg has joined #ruby
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<matthewd> efffe: `bundle install` will indeed install exactly what's specified in the lockfile. If it's not, you have an old version of bundler (there were some narrow cases where some things would get updated), or something else (some bundler+shell enhancement?) that's getting overly enthusiastic.
<efffe> hm, maybe it's something on our end
vali has quit [Quit: vali]
zipace has joined #ruby
d^sh has quit [Ping timeout: 256 seconds]
govg has quit [Ping timeout: 258 seconds]
d^sh has joined #ruby
aryaching has quit [Read error: Connection reset by peer]
aryaching has joined #ruby
_whitelogger has joined #ruby
spicerack has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
aryaching has quit [Ping timeout: 246 seconds]
tubuliferous has joined #ruby
bkxd has quit [Ping timeout: 260 seconds]
duckpupp1 has joined #ruby
efffe has quit [Quit: Page closed]
duckpupp1 has quit [Ping timeout: 268 seconds]
spicerack has joined #ruby
_whitelogger has joined #ruby
zipace has quit [Ping timeout: 268 seconds]
tau has joined #ruby
<icyphox> havenwood: Thanks for all the help mate.
<icyphox> But I figured out a way to do it with Python instead :)
pytuger has quit [Ping timeout: 240 seconds]
banisterfiend has joined #ruby
pytuger has joined #ruby
pytuger has quit [Changing host]
pytuger has joined #ruby
swemoney has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tau has quit [Remote host closed the connection]
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
thatsnotjack has joined #ruby
tommylom1ykins has quit [Ping timeout: 240 seconds]
hndk has joined #ruby
hahuang61 has quit [Ping timeout: 240 seconds]
aglorei1 has quit [Quit: WeeChat 1.4]
cfec0b8d has joined #ruby
unshadow has joined #ruby
bkxd has joined #ruby
aglorei has joined #ruby
shinnya has joined #ruby
bkxd has quit [Ping timeout: 268 seconds]
thatsnotjack has quit [Ping timeout: 260 seconds]
grh has joined #ruby
Channel6 has quit [Quit: Leaving]
acalycine has quit [Quit: bye]
jgnagy has quit [Remote host closed the connection]
jgnagy has joined #ruby
pulkit4tech has joined #ruby
socxon has joined #ruby
aep has quit [Ping timeout: 240 seconds]
rippa has joined #ruby
frumosa has joined #ruby
<frumosa> Hey
banisterfiend has joined #ruby
<frumosa> How can one find RailsVersion by looking at configuration
<frumosa> Like i tried config/boot.rb et
<frumosa> But i am unable to see rails version
agent_white has joined #ruby
<matthewd> frumosa: Check the Gemfile / Gemfile.lock
libastral has quit [Quit: ZNC - http://znc.in]
<frumosa> What should be the path of Gemfile or Gemfile.lock , is it inside any sub-directory matthewd
libastral has joined #ruby
<matthewd> It's in the root of the application. If it's not there, that suggests the rails version is very old. Head to #rubyonrails and we can try to work it out.
<frumosa> sure matthewd
<frumosa> I got something like gem 'rails', '~> 5.0.2'
<frumosa> so that means my version is 5.0.2
croberts has quit [Ping timeout: 258 seconds]
<matthewd> Ah okay, yes, that's current
<frumosa> Latest one cool
Xiti has quit [Quit: Xiti]
pmunt has joined #ruby
atmosx_ has joined #ruby
atmosx_ has left #ruby [#ruby]
Toledo has joined #ruby
<frumosa> What can someone do potentially incase they have secret_token of my rail app
ddffg has joined #ruby
GreySunshine has joined #ruby
antgel has joined #ruby
<GreySunshine> Hello, I tried installing ffi gem and I'm getting this error http://lpaste.net/354193 what should I do?
djbkd has joined #ruby
djbkd has quit [Client Quit]
planigan has quit [Ping timeout: 240 seconds]
planigan has joined #ruby
<matthewd> GreySunshine: Install the missing header files. You seem to be using a system- / OS package manager-provided ruby, so there's probably a separate package that contains the headers.
<matthewd> GreySunshine: General advice is to avoid system ruby in local development environments.. though opinions vary for production deployments
Pumukel has joined #ruby
spicerack has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
duckpupp1 has joined #ruby
migge has quit [Quit: migge]
hndk has quit [Quit: Leaving]
doublemalt__ has joined #ruby
duckpupp1 has quit [Ping timeout: 258 seconds]
bkxd has joined #ruby
frumosa has quit [Quit: Page closed]
bkxd has quit [Ping timeout: 240 seconds]
antgel has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
toretore has joined #ruby
jgnagy has quit []
jameser has joined #ruby
johnny56 has quit [Ping timeout: 264 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
mazeinmaze_ has quit [Ping timeout: 256 seconds]
kegster has quit [Ping timeout: 258 seconds]
kegster has joined #ruby
rippa has joined #ruby
Qchmqs has joined #ruby
johnny56 has joined #ruby
lucas1 has joined #ruby
lucas1 has quit [Client Quit]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
spicerack has joined #ruby
chouhoulis has joined #ruby
tubuliferous has quit [Quit: Textual IRC Client: www.textualapp.com]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
anuxivm has joined #ruby
chouhoulis has quit [Ping timeout: 260 seconds]
<agent_white> Under sane opinion, do not use the system ruby in production.
_sfiguser has quit [Ping timeout: 246 seconds]
<agent_white> If so, likely all hope has already been lost and you're just along for the good coffee.
marr has joined #ruby
TomyLobo2 has joined #ruby
anuxivm has left #ruby [#ruby]
cfec0b8d has quit [Remote host closed the connection]
tildes has joined #ruby
pifon has quit [Quit: Connection closed for inactivity]
tau has joined #ruby
jusa has quit [Ping timeout: 256 seconds]
_sfiguser has joined #ruby
cfec0b8d has joined #ruby
jameser has joined #ruby
cfec0b8d has quit [Remote host closed the connection]
jameser has quit [Client Quit]
swemoney has joined #ruby
Snickers has joined #ruby
grh has quit [Ping timeout: 260 seconds]
byte512 has quit [Ping timeout: 256 seconds]
swemoney has quit [Quit: Textual IRC Client: www.textualapp.com]
sarbs has quit [Read error: Connection reset by peer]
grh has joined #ruby
kegster has quit [Ping timeout: 260 seconds]
kegster has joined #ruby
sarbs has joined #ruby
agent_white has quit [Quit: agent_white]
govg has joined #ruby
lenwood has joined #ruby
gloscombe has joined #ruby
gloscombe is now known as gloscombe_
Jackneill has joined #ruby
sarbs has quit [Excess Flood]
<darix> matthewd: if you want to be sure that your stuff is working on production and you prefer system ruby there ... i would stick to system ruby in my dev env too.
<darix> but that is just me
gloscombe_ has quit [Read error: Connection reset by peer]
duckpupp1 has joined #ruby
maloik has quit [Remote host closed the connection]
Jackneill_ has joined #ruby
maloik has joined #ruby
Jackneill has quit [Ping timeout: 268 seconds]
acalycine has joined #ruby
bkxd has joined #ruby
duckpupp1 has quit [Ping timeout: 260 seconds]
_whitelogger has joined #ruby
ddffg has quit [Ping timeout: 240 seconds]
lenwood has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
pulkit4tech has quit [Quit: Connection closed for inactivity]
marr has quit [Remote host closed the connection]
grh has quit [Ping timeout: 240 seconds]
doublemalt_ has joined #ruby
doublemalt__ has quit [Ping timeout: 240 seconds]
govg has quit [Read error: Connection reset by peer]
conta has joined #ruby
jgt has joined #ruby
tildes has quit [Ping timeout: 240 seconds]
jameser has joined #ruby
tildes has joined #ruby
postmodern has quit [Quit: Leaving]
ddffg has joined #ruby
jusa has joined #ruby
byte512 has joined #ruby
jusa has quit [Ping timeout: 256 seconds]
gloscombe_ has joined #ruby
pulkit4tech has joined #ruby
ddffg has quit [Ping timeout: 256 seconds]
sepp2k has joined #ruby
fmartingr has joined #ruby
mjc__ has quit [Quit: Connection closed for inactivity]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
danielpclark has joined #ruby
ddffg has joined #ruby
govg has joined #ruby
tildes has quit [Ping timeout: 264 seconds]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
byte512 has quit [Quit: Bye.]
antgel has joined #ruby
byte512 has joined #ruby
pmunt has quit [Remote host closed the connection]
yurikoles has joined #ruby
yeticry has quit [Ping timeout: 246 seconds]
conta has quit [Ping timeout: 264 seconds]
yeticry has joined #ruby
duckpupp1 has joined #ruby
duckpupp1 has quit [Ping timeout: 240 seconds]
Pumukel has quit [Remote host closed the connection]
Pumukel has joined #ruby
charliesome has joined #ruby
Snickers has quit [Quit: Snickers]
nowhere_man has joined #ruby
dlitvak has quit [Quit: Connection closed for inactivity]
Pumukel has quit [Ping timeout: 260 seconds]
danielpclark has quit [Quit: Leaving]
jusa has joined #ruby
workmad3 has quit [Ping timeout: 240 seconds]
unshadow has quit [Ping timeout: 240 seconds]
minimalism has quit [Ping timeout: 240 seconds]
unshadow has joined #ruby
blackwind_123 has quit [Ping timeout: 256 seconds]
rgtk has joined #ruby
ddffg has quit [Ping timeout: 260 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bkxd has quit [Ping timeout: 240 seconds]
unshadow has quit [Ping timeout: 240 seconds]
unshadow has joined #ruby
Verity has quit [Quit: Leaving]
unshadow has quit [Client Quit]
ddffg has joined #ruby
Arpanet69 has joined #ruby
rippa has joined #ruby
Rodya_ has joined #ruby
meshsmith has joined #ruby
jrafanie has joined #ruby
jcao219 has joined #ruby
<manveru> darix: well, that's exactly right though :)
fmartingr has quit [Quit: Connection closed for inactivity]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pulkit4tech has quit [Quit: Connection closed for inactivity]
GreySunshine has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
sepp2k has quit [Read error: Connection reset by peer]
xall_ has joined #ruby
pilne has joined #ruby
jcao219 has quit [Ping timeout: 256 seconds]
hndk has joined #ruby
grh has joined #ruby
Xiti has joined #ruby
Pumukel has joined #ruby
HoierM has joined #ruby
GodFather has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
conta has joined #ruby
Qommand0r has quit [Quit: WeeChat 1.7]
SCHAAP137 has quit [Read error: Connection reset by peer]
Rodya_ has quit [Remote host closed the connection]
rgtk has quit [Ping timeout: 246 seconds]
xall_ has quit [Ping timeout: 268 seconds]
xall_ has joined #ruby
SCHAAP137 has joined #ruby
madgen has joined #ruby
ineb has quit [Quit: leaving]
govg has quit [Quit: leaving]
govg has joined #ruby
grh has quit [Ping timeout: 256 seconds]
madgen has quit [Quit: Lost terminal]
gbaptista_ has joined #ruby
gbaptista has quit [Ping timeout: 258 seconds]
Elenaltarien has quit [Read error: Connection reset by peer]
houhoulis has joined #ruby
socxon has quit [Remote host closed the connection]
johnzorn has quit [Ping timeout: 260 seconds]
shinnya has quit [Ping timeout: 258 seconds]
johnzorn has joined #ruby
harfangk has joined #ruby
jcao219 has joined #ruby
Pumukel has quit [Remote host closed the connection]
Rodya_ has joined #ruby
Mon_Ouie has quit [Ping timeout: 240 seconds]
zipace has joined #ruby
meshsmith has quit [Ping timeout: 240 seconds]
conta has quit [Ping timeout: 260 seconds]
Rodya_ has quit [Ping timeout: 246 seconds]
qchmqs_ has joined #ruby
c0mrad3 has joined #ruby
rgtk has joined #ruby
armando has quit [Remote host closed the connection]
nertzy has quit [Read error: Connection reset by peer]
Qchmqs has quit [Ping timeout: 268 seconds]
qchmqs_ has quit [Client Quit]
Axy has quit [Read error: Connection reset by peer]
Qchmqs has joined #ruby
thatsnotjack has joined #ruby
hndk has quit [Remote host closed the connection]
conta has joined #ruby
GodFather has quit [Remote host closed the connection]
DLSteve_ has joined #ruby
GodFather has joined #ruby
ltem has joined #ruby
electrostat has quit [Quit: uwotm8]
nowhere_man has quit [Ping timeout: 240 seconds]
electrostat has joined #ruby
GodFather has quit [Remote host closed the connection]
GodFather has joined #ruby
millerti has joined #ruby
zipace has quit [Disconnected by services]
ziprar has joined #ruby
RubyLearner has joined #ruby
antgel has quit [Ping timeout: 240 seconds]
<RubyLearner> Can you tell me the best book for getting to know Ruby completely? I have been following this book , metaprogramming ruby by perrota , it would be a big help
scottschecter has quit [Quit: ZNC 1.6.3+deb1 - http://znc.in]
nixmaniack has joined #ruby
nixmaniack has joined #ruby
nixmaniack has quit [Changing host]
<matthewd> RubyLearner: At a certain point, practice is the important part
muelleme_ has quit [Ping timeout: 240 seconds]
nixmaniack has quit [Client Quit]
scottschecter has joined #ruby
scottschecter has quit [Remote host closed the connection]
<RubyLearner> I agree, but I have been coding on Ruby On Rails for around 3 years now, but I want to learn Ruby now.
<RubyLearner> <matthewd>
<elomatreb> If you've been using Rails you were already programming Ruby, just with a lot of additional libraries
scottschecter has joined #ruby
Rodya_ has joined #ruby
<apeiros> RubyLearner: eloquent ruby, ruby under a microscope, why's poignant guide, …
spicerack has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
blackwind_123 has joined #ruby
<RubyLearner> Yes, but when i look at the code in gems, it's pure ruby like singlelton, instance_eval, class_eval, dynamic methods and everything else. <elomatreb>
<allisio> RubyLearner: And Metaprogramming Ruby hasn't been explaining those?
meshsmith has joined #ruby
<allisio> That book dives pretty deeply into what all you can get up to in that department, as I recall.
meshsmith has quit [Remote host closed the connection]
Rodya_ has quit [Ping timeout: 246 seconds]
<RubyLearner> <allisio> Yes, it has been, but am i on the right track to learn ruby, that's what i want to ask. Yes, you are right it covers these extensively.
thatsnotjack has quit [Ping timeout: 256 seconds]
tildes has joined #ruby
<allisio> RubyLearner: Most folks recommend Eloquent Ruby for non-beginners that really want to get a feel for the language.
jcao219 has quit [Ping timeout: 240 seconds]
__Yiota has joined #ruby
<RubyLearner> Thanks <allisio> , <apeiros>, <elomatreb>
al2o3-cr has joined #ruby
shinnya has joined #ruby
Lord_of_Life has quit [Excess Flood]
m1911 has joined #ruby
Lord_of_Life has joined #ruby
bkxd has joined #ruby
m1911 has quit [Client Quit]
m1911 has joined #ruby
m1911 has quit [Excess Flood]
m1911 has joined #ruby
m1911 has quit [Excess Flood]
grh has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rr4sT has joined #ruby
doublemalt_ has quit [Ping timeout: 256 seconds]
Qchmqs has quit [Ping timeout: 258 seconds]
bkxd has quit [Ping timeout: 240 seconds]
minimalism has joined #ruby
conta has quit [Ping timeout: 260 seconds]
RubyLearner has left #ruby [#ruby]
grh has quit [Ping timeout: 256 seconds]
DoubleMalt has joined #ruby
sepp2k has joined #ruby
xall_ has quit [Ping timeout: 260 seconds]
d3d1rty has joined #ruby
ggsmid has joined #ruby
shinnya has quit [Ping timeout: 240 seconds]
Guest86528 has quit [Ping timeout: 268 seconds]
d3d1rty has quit [Remote host closed the connection]
rgtk has quit [Ping timeout: 264 seconds]
DoubleMalt has quit [Ping timeout: 240 seconds]
nowhere_man has joined #ruby
kegster has quit [Ping timeout: 268 seconds]
spicerack has joined #ruby
kegster has joined #ruby
aglorei has quit [Read error: Connection reset by peer]
bronson_ has joined #ruby
aglorei has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
aglorei has quit [Remote host closed the connection]
aglorei has joined #ruby
allisio has quit [Quit: WeeChat 1.8-dev]
Rodya_ has joined #ruby
allisio has joined #ruby
nofxx has joined #ruby
DoubleMalt has joined #ruby
_sfiguser has quit [Ping timeout: 260 seconds]
kegster has quit [Ping timeout: 256 seconds]
Rodya_ has quit [Ping timeout: 246 seconds]
kegster has joined #ruby
ltem has quit [Quit: Leaving]
optiz0r has left #ruby ["Leaving"]
bronson_ has quit [Ping timeout: 260 seconds]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
mazeinmaze_ has joined #ruby
DLSteve_ has quit [Quit: All rise, the honorable DLSteve has left the channel.]
xall_ has joined #ruby
_sfiguser has joined #ruby
conta has joined #ruby
ayonkhan has joined #ruby
houhoulis has quit [Remote host closed the connection]
ayonkhan has quit [Read error: Connection reset by peer]
conta has quit [Ping timeout: 260 seconds]
jrafanie has joined #ruby
conta has joined #ruby
ayonkhan has joined #ruby
rgtk has joined #ruby
Mia has quit [Read error: Connection reset by peer]
jameser has joined #ruby
Fernando-Basso has joined #ruby
tau has quit [Remote host closed the connection]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jameser has quit [Ping timeout: 268 seconds]
cagmz has joined #ruby
nowhere_man has quit [Ping timeout: 240 seconds]
spicerack has quit [Quit: Textual IRC Client: www.textualapp.com]
spicerack has joined #ruby
blackwind_123 has quit [Read error: Connection reset by peer]
blackwind_123 has joined #ruby
gloscombe_ has quit [Remote host closed the connection]
hahuang61 has joined #ruby
hahuang61 has quit [Ping timeout: 260 seconds]
grh has joined #ruby
nowhere_man has joined #ruby
Rodya_ has joined #ruby
milardovich has joined #ruby
conta has quit [Ping timeout: 260 seconds]
singalaut has joined #ruby
gloscombe_ has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
sepp2k has quit [Read error: Connection reset by peer]
mrwn has joined #ruby
mrwn has quit [Remote host closed the connection]
mrwn has joined #ruby
xall_ has quit [Ping timeout: 260 seconds]
mrwn has quit [Remote host closed the connection]
johnzorn has quit [Ping timeout: 240 seconds]
GodFather has quit [Remote host closed the connection]
grh has quit [Remote host closed the connection]
nadir has quit [Quit: Connection closed for inactivity]
Channel6 has joined #ruby
duckpupp1 has joined #ruby
GodFather has joined #ruby
ziprar is now known as zipace
GodFather has quit [Remote host closed the connection]
xall_ has joined #ruby
Lord_of_Life has quit [Excess Flood]
kegster has quit [Ping timeout: 260 seconds]
_aeris_ has quit [Remote host closed the connection]
Lord_of_Life has joined #ruby
Lord_of_Life has quit [Excess Flood]
milardovich has quit []
duckpupp1 has quit [Ping timeout: 240 seconds]
blackwind_123 has quit [Ping timeout: 260 seconds]
kegster has joined #ruby
Lord_of_Life has joined #ruby
ggsmid has quit [Remote host closed the connection]
_aeris_ has joined #ruby
kegster has quit [Changing host]
kegster has joined #ruby
xall_ has quit [Ping timeout: 246 seconds]
blackwind_123 has joined #ruby
vali has joined #ruby
DoubleMalt has quit [Quit: Leaving]
GodFather has joined #ruby
johnzorn has joined #ruby
P1ro has joined #ruby
Rr4sT has quit [Quit: Connection closed for inactivity]
cfec0b8d has joined #ruby
nowhere_man has quit [Ping timeout: 260 seconds]
houhoulis has joined #ruby
vali has quit [Ping timeout: 240 seconds]
xall_ has joined #ruby
blackwind_123 has quit [Ping timeout: 240 seconds]
blackwind_123 has joined #ruby
kegster has quit [Ping timeout: 260 seconds]
thatsnotjack has joined #ruby
kegster has joined #ruby
Sammichmaker has joined #ruby
kirun has joined #ruby
derp10327 has joined #ruby
<derp10327> Back at it again learning ruby once more :)
<derp10327> Unfortunately RubyMine seems to have gotten less "IntelliJ"-esque after updating to 2017.1
naprimer_2 has quit [Ping timeout: 260 seconds]
blackwind_123 has quit [Ping timeout: 268 seconds]
blackwind_123 has joined #ruby
mustmodify has joined #ruby
<mustmodify> how do I fix a conflict between rubygems and ruby? rubygems thinks it's using 2.4, which he tried to uninstall, and ruby is 2.3.4
naprimer_2 has joined #ruby
ayonkhan_ has joined #ruby
ayonkhan has quit [Ping timeout: 260 seconds]
rgtk has quit [Ping timeout: 268 seconds]
rgtk has joined #ruby
blackwind_123 has quit [Ping timeout: 268 seconds]
blackwind_123 has joined #ruby
<havenwood> (solution from more discussion on #rubyonrails ^ was installing the missing Bundler gem on Ruby 2.3.4)
<mustmodify> hooray!
mustmodify has left #ruby [#ruby]
Rodya_ has joined #ruby
bronson has joined #ruby
misterpink has quit [Read error: Connection reset by peer]
Channel6 has quit [Quit: Leaving]
Rodya_ has quit [Ping timeout: 246 seconds]
bronson has quit [Ping timeout: 256 seconds]
<derp10327> Simple question: So in some programming languages (one that comes to mind is Python, so I'll use its syntax for this) it is possible to import modules using aliases via "import foo as bar"
<derp10327> I'm learning ruby through programming challenges, currently I'm doing some from exercism, and the test suite has me slightly confused
<derp10327> I don't want to alter the test framework of course
<derp10327> here's a snippet https://hastebin.com/lacevibehu.rb
<derp10327> On line 6 they refer to a module (I think this is considered a module? or is a class?) as Complement, however the require_relative is a class called RnaTranscription
<derp10327> Or should I refactor my class name (leaving the filename as is) to "Complement" in the code?
<derp10327> What's the ruby way for this?
Wsewolod has joined #ruby
araujo has quit [Quit: Leaving]
<apeiros> derp10327: convention is to name the file according to the constant defined in it
<apeiros> (and stuff starting with an uppercase letter are constants - those may reference a class or a module)
<derp10327> apeiros, so the conventions can't be followed without altering the test suite then right?
<apeiros> e.g. Foo::BarBaz should be in foo/barbaz.rb (ruby convention) or foo/bar_baz.rb (rails convention)
mooser has joined #ruby
<derp10327> apeiros, i thought it would be foo/bar_baz.rb in ruby too? Damn rubymine is screwing me up everywhere lol
<apeiros> derp10327: I only have your excerpt. if rna_transcription should define Complement, then you're correct, they don't follow the conventions (which is bad and they should be told so)
Arpanet69 has quit [Ping timeout: 268 seconds]
<matthewd> derp10327: Well, the named file might in turn load a file named complement.rb
<apeiros> derp10327: no, ruby and rails conventions differ there. rails conventions start to become more common in non-rails code too, though.
<apeiros> at least that's my impression
<derp10327> matthewd, right, but I think I can only submit one file per solution
<matthewd> But I think these exercises are designed to be small-scale, such that you'd have a single file defining all the things
<derp10327> apeiros, I'm sure you're right, rubymine hasn't been friendly since I updated to 2017.1 yesterday :/
<matthewd> Yeah, in that case, it seems reasonable enough to name it after the program, rather than an individual constant it defines
patarr has joined #ruby
<derp10327> The IntelliSense is faulty, I.E.: a variable containing a string, str, won't give suggestions from the string libraries
<matthewd> *You* know it contains a string..
centrx has joined #ruby
<derp10327> even typing: " "I'm a string". " doesn't give suggestions
<centrx> Github says Nokogiri is a parser for "HTML, XML, SAX, and Reader"
<centrx> What is "Reader"?
<matthewd> Ah okay. I'll grant that it could probably figure that one out ;)
<derp10327> matthewd for $199 a year it oughta lol
GodFather has quit [Remote host closed the connection]
jcao219 has joined #ruby
<matthewd> centrx: I believe Reader is a parse API similar to, but different from, SAX
armando has joined #ruby
blackwind_123 has quit [Ping timeout: 268 seconds]
P1ro has quit [Remote host closed the connection]
<apeiros> it's funny to mix HTML & XML together with SAX and Reader. the former are the languages it parses, the latter are methods.
GodFather has joined #ruby
dlitvak has joined #ruby
Arpanet69 has joined #ruby
houhoulis has quit [Remote host closed the connection]
blackwind_123 has joined #ruby
<apeiros> nokogiri parses html and xml, and it provides dom-, sax- and pullparser. it might be that pull parsers are also called reader, not sure. and I'm never sure about the diff between sax & pull.
GodFather has quit [Remote host closed the connection]
Slinky_Pete has joined #ruby
patarr has quit [Ping timeout: 260 seconds]
P1ro has joined #ruby
GodFather has joined #ruby
Vile` has joined #ruby
GodFather has quit [Remote host closed the connection]
GodFather has joined #ruby
blackwind_123 has quit [Ping timeout: 268 seconds]
vali has joined #ruby
blackwind_123 has joined #ruby
<matthewd> .. and Rails actually breaks that convention by failing to include underscores in its gem names :P
mikeiniowa has quit [Ping timeout: 256 seconds]
kith has quit [Quit: kith]
<centrx> matthewd: Thank you
<centrx> apeiros: Thank you
ayonkhan_ has quit [Ping timeout: 240 seconds]
hndk has joined #ruby
gloscombe_ has left #ruby [#ruby]
kegster has quit [Read error: Connection reset by peer]
gloscombe_ has joined #ruby
hahuang61 has joined #ruby
kegster has joined #ruby
ayonkhan has joined #ruby
hahuang61 has quit [Ping timeout: 246 seconds]
mooser has quit [Remote host closed the connection]
Rodya_ has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
blackwind_123 has quit [Ping timeout: 268 seconds]
vali has quit [Ping timeout: 256 seconds]
blackwind_123 has joined #ruby
bkxd has joined #ruby
centrx has quit []
mooser has joined #ruby
GodFather has quit [Read error: Connection reset by peer]
vali has joined #ruby
kegster has quit [Quit: Shiner, TX makes good beer.]
GodFather has joined #ruby
patarr has joined #ruby
kith has joined #ruby
bkxd has quit [Ping timeout: 258 seconds]
mooser has quit [Ping timeout: 260 seconds]
duckpupp1 has joined #ruby
hndk has quit [Quit: Leaving]
kegster has joined #ruby
wilbert has joined #ruby
ayonkhan has quit [Ping timeout: 240 seconds]
ayonkhan has joined #ruby
kegster has quit [Client Quit]
duckpupp1 has quit [Ping timeout: 260 seconds]
kegster has joined #ruby
xall_ has quit [Ping timeout: 240 seconds]
must_modify has joined #ruby
gloscombe_ has left #ruby [#ruby]
<must_modify> So now we're working on using ruby-install to get this guy's ruby working on his mac.
ltem has joined #ruby
<must_modify> WHAT??? Permission denied as root??!!?!?!
Arpanet69 has quit [Ping timeout: 268 seconds]
Xeago_ has joined #ruby
Xeago has quit [Ping timeout: 258 seconds]
Xeago_ is now known as Xeago
<havenwood> must_modify: Hehe, why are you using Homebrew as root?
<derp10327> Okay another simple question that I don't know how to word properly in order to google it: in each test fixture in this test suite, the assertions are written roughly as follows "expected, Squares.new(different integer here in each fixture).square_of_sum"
<must_modify> I told him to `sudo su` to use ruby-install because that's what I thought he was supposed to do.
patarr has quit [Ping timeout: 260 seconds]
<derp10327> where is the argument passed in "new()" going?
blackwind_123 has quit [Ping timeout: 268 seconds]
<havenwood> must_modify: Nope, no need to do that. You can use ruby-install without sudo. It'll install Rubies to ~/.rubies/, which is a nice setup on macOS.
<apeiros> derp10327: new calls initialize with all args + block
<derp10327> apeiros, thank you :)
<havenwood> must_modify: Since Homebrew is a single-user package manager, Homebrew users tend to do a sudo-less install with ruby-install, since you won't be supporting additional users.
<derp10327> so I need an initialize method then right?
<apeiros> Class#new is basically this: class Class; def new(*args, &block); obj = allocate; obj.__send__(:initialize, *args, &block); obj; end; end
blackwind_123 has joined #ruby
<apeiros> derp10327: if you want to do stuff on new, yes
<derp10327> okay :)
<apeiros> but you can write classes without initialize.
ule has joined #ruby
<must_modify> havenwood: So if his homebrew rubies are messed up, I wonder if this will actually solve our problem. I guess we'll find out.
<havenwood> must_modify: ruby-install plays nice with brew if you just use the Homebrew user: https://github.com/postmodern/ruby-install/blob/master/share/ruby-install/util.sh#L97-L99
<havenwood> must_modify: brew uninstall ruby && ruby-install --latest ruby 2.3 # or whatever version you are using
<apeiros> must_modify: yes, root is no longer able to do everything on macOS
<must_modify> I see.
<must_modify> thanks.
<allisio> It's still funny.
<apeiros> apple apparently doesn't want to allow a couple of ways to shoot your own foot :D
patarr has joined #ruby
<allisio> Oh, that? That's "my" Mac.
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<havenwood> must_modify: Or you can leave the brew version, it doesn't matter. You can have chruby fall back to brew with `chruby system` and have system Ruby fall back to real system Ruby with `brew unlink ruby`.
<ule> hi guys..
<havenwood> hi ule
ayonkhan has quit [Quit: Textual IRC Client: www.textualapp.com]
<ule> I'm trying to get the closest values based on a key.. for example:
<ule> [{:name => 'aaa', :foo => 8.1}, {:name => 'bbb', :foo => 9.4}, {:name => 'ccc', :foo => 12}, {:name => 'ddd', :foo=> 15}, {:name => 'eee', :foo => 16.2}]
nadir has joined #ruby
<apeiros> ule: are the names unique? if so… why array of hashes and not just a hash directly?
<ule> If I pass 10.2, I want to see the closest above: {:name => 'bbb', :foo => 9.4}
kjetilho has left #ruby [#ruby]
<apeiros> ule: Enumerable#min_by
<ule> apeiros: the names are unique
<ule> min_by.. ok I'm checking here!!
<ule> looks like min_by returns 8.1
<ule> but I want the closest to 10, which would be 9.4
<apeiros> ule: what's the code you used in your block?
<ule> foo.min_by {|x| x[:foo] }
<ule> I don't know how to set the 10 over there
<apeiros> yeah, that gives you the item with the smallest value in :foo
<ule> humm
<apeiros> so your next step is to figure out a piece of code which gives you an information about how far away from your "needle" (10.2) your :foo value is
<apeiros> and put that piece of code into the block
skweek has quit [Ping timeout: 256 seconds]
<ule> make sense
<apeiros> got an idea?
jcao219 has quit [Ping timeout: 260 seconds]
<ule> my_array.reverse.find { |e| e < 10 }
<allisio> No, not that.
<ule> :/
<havenwood> ule: Are you looking for the first value that is less than 10?
<ule> yes!
<apeiros> no :)
<allisio> Well, that's not what he originally said, anyway.
<havenwood> ule: I don't think that's what you want.
<ule> but I need to return the hash.. so {:name => ... :foo => 9.4}
<apeiros> ule: how did you figure out that 9.4 is closer to 10.2 than 8.1?
<ule> apeiros: I could use sort and then get the element above using key - 1
<apeiros> you'll run into the same problem with sort
<havenwood> ule: If I give you two numbers, say 5 and 7 or 9 and 3, how can you figure out the difference between the two numbers?
<apeiros> you first have to find the answer to the above question
Jackneill_ has quit [Remote host closed the connection]
<apeiros> > how did you figure out that 9.4 is closer to 10.2 than 8.1?
<allisio> >> [5 - 7, 7 - 5, 9 - 3, 3 - 9] # ule
<ruby[bot]> allisio: # => [-2, 2, 6, -6] (https://eval.in/766468)
<allisio> I see a pattern.
tildes has quit [Ping timeout: 240 seconds]
<ule> hummm
<apeiros> too many cooks IMO
<allisio> Who's leaving?
<havenwood> I have to leave!
* havenwood tags out
<havenwood> \o
<apeiros> o/
Simplicity has left #ruby ["Leaving"]
<allisio> For what it's worth, if someone doesn't know about nofbyhgr inyhr, no amount of guiding them is going to magically get them there.
<apeiros> allisio: sure. one step at a time.
jcao219 has joined #ruby
<apeiros> I'm never sure about the correct arguments to tr for that one… :'(
<apeiros> (usually still get it at first try, though)
cyphase has quit [Ping timeout: 240 seconds]
<allisio> Knowing the position of the letters in the alphabet is a nifty party trick.
<allisio> For about eight seconds.
<apeiros> ule: ok, maybe a different question - how close are 9.4 and 10.2?
DTZUZO has quit [Read error: Connection reset by peer]
<apeiros> allisio: I only know vaguely and I'm too lazy to count. so I usually try the one I *think* is the right for the cut-off point and would then try the chars before/after. but since first try was a hit :D
<apeiros> (yes, I know, I could just let ruby do it for me)
<allisio> apeiros: M is 13 and the step(5) is EJOTY.
<allisio> Pretty easy to get around from there.
<apeiros> [*"A".."Z"][ze_value-1]
<allisio> It becomes fairly automatic with surprising rapidity.
<apeiros> I rarely ever need to know alphabet positions?
<allisio> That's not my problem.
<apeiros> you often need them?
<allisio> Constantly. :<
tildes has joined #ruby
thatsnotjack has quit [Ping timeout: 256 seconds]
<apeiros> ule: ok, not sure where you are. I'll be leaving in ~15min.
<apeiros> allisio: interesting. may I ask what for?
<ule> apeiros: im here
<ule> apeiros: sorry.. I'm trying here
<apeiros> I'm pretty sure you'd get there quicker if you'd answer the question :-p
<ule> if I split my hash based on target, then I can use min or max on those slices
<apeiros> and then you have two candidates and still have to figure which one is closer
mim1k has joined #ruby
<apeiros> which - again - requires you to find an answer to the above question ;-)
<ule> I actually need the lower and upper values.. because I'm using these values to get a linear interpolation
cyphase has joined #ruby
patarr has quit [Ping timeout: 258 seconds]
<apeiros> ok, yes, in that case you can partition and min_by/max_by the two resulting arrays based on :foo's value
wilbert has quit [Ping timeout: 246 seconds]
<ule> lower = foo.select {|x| x[:foo] < 10 }.last
<ule> where foo is my hash
<ule> worked!
<apeiros> no
<apeiros> coincidence
<ule> => {:name=>"bbb", :foo=>9.4}
<apeiros> reorder your items and it'll return a different result
<allisio> What's wrong with #minmax?
<ule> yeah.. Indeed in this case I need it sorted to work
Rodya_ has joined #ruby
<apeiros> allisio: I couldn't come up with a solution immediately, so I figured if possible it'd be a "clever" solution and thus probably not the right choice for ule
<allisio> No.
<apeiros> ule: sorting by :foo first works, yes. and then you can use .first/.last instead of .min_by/.max_by on the partitions.
<allisio> ule: You don't need to sort your input; as has already been said, you need to figure out what sort of predicate to pass to #min_by/#max_by/#minmax.
patarr has joined #ruby
<apeiros> ule: note though, min_by/max_by are less computationally expensive than sort_by.
<ule> so basically, in terms of math, I could loop through all rows.. checking the difference from those numbers.. and in the end, return those with lower difference
<allisio> Questions have arisen that I can't politely ask until we've got this sorted out. :/
<apeiros> ule: yes
<allisio> ule: Now, then, how to determine the least difference?
cyphase has quit [Ping timeout: 260 seconds]
muelleme_ has joined #ruby
<ule> allisio: getting the first one from a list of differences or the minimum
Rodya_ has quit [Ping timeout: 246 seconds]
<ule> lower = [{:name=>"aaa", :foo=>8.1}, {:name=>"bbb", :foo=>9.4}, {:name=>"ccc", :foo=>12}, {:name=>"ddd", :foo=>15}, {:name=>"eee", :foo=>16.2}].sort_by{ |x| x[:foo] }.select {|x| x[:foo] < 10 }.last
harfangk has quit [Quit: Textual IRC Client: www.textualapp.com]
<ule> => {:name=>"bbb", :foo=>9.4}
<ule> :)
cyphase has joined #ruby
<ule> upper = [{:name=>"aaa", :foo=>8.1}, {:name=>"bbb", :foo=>9.4}, {:name=>"ccc", :foo=>12}, {:name=>"ddd", :foo=>15}, {:name=>"eee", :foo=>16.2}].sort_by{ |x| x[:foo] }.select {|x| x[:foo] > 10 }.first
<apeiros> ok, since you worked out a solution and I've to go:
<ule> => {:name=>"ccc", :foo=>12}
<allisio> He hasn't worked out a solution.
<ule> lol
<ule> thanks anyways
<allisio> ule: Do you not want 10.3 to be considered closer to 10.2 than 9.4?
yurikoles has quit [Remote host closed the connection]
<ule> I just need the lower and upper numbers
<apeiros> allisio: hm? looks correct to me? they corrected their question in that they want both, closest upper and lower, not only the closest.
<ule> exactly.. my bad, it's not the closest, its upper and lower
<allisio> ule: If you had a `{:name=>"fff", :foo=>10.3}` in your collection, you'd still want `lower` to be `{:name=>"bbb", :foo=>9.4}`?
<apeiros> needle = 10; lowers, uppers = data.partition { |date| date[:foo] < needle }; lower = lowers.min_by { |date| needle - date[:foo] }; upper = upper.min_by { |date| date[:foo] - needle }
vali has quit [Ping timeout: 268 seconds]
<ule> apeiros: yes
<ule> ops
<allisio> ule: Gotcha.
<ule> allisio: yeah
<apeiros> no sorting needed. you could do it in one iteration even, but that's more annoying to code.
<ule> apeiros: much cleaner.. let me understand what you did
<apeiros> and if you're still looking for "closest", a single min_by is sufficient and allisio will certainly get you there
muelleme_ has quit [Ping timeout: 258 seconds]
* apeiros gotta go, might check again in a couple of minutes and then be off for the night
<allisio> ule: For posterity's sake, this is what I thought you wanted: https://eval.in/766477
<ule> you guys are awesome
<allisio> No, you.
<allisio> Er, that #to_a is superfluous, by the way; the real fix was to parenthesize the block parameters and I just forgot to remove it.
jgt has quit [Ping timeout: 240 seconds]
marcdel has joined #ruby
marcdel has quit [Max SendQ exceeded]
marcdel has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
Mon_Ouie has joined #ruby
<apeiros> allisio: I actually have a minmax solution for what they want. it's indeed a bit clever.
<apeiros> I'm not entirely convinced it's correct, but: needle = 10; h.minmax_by { |(k,v)| 1.0/(v-needle) } # using your code for h
milardovich has joined #ruby
tildes has quit [Ping timeout: 256 seconds]
<apeiros> btw., your code lacks a _by (minmax doesn't take a block, but it won't yell at you if you pass it one)
armyriad has quit [Ping timeout: 240 seconds]
<allisio> apeiros: I'm having trouble determining why you'd say that.
<apeiros> oh, I'm wrong. minmax = minmax_by? interesting…
<allisio> Almost.
BackEndCoder has quit [Excess Flood]
armyriad has joined #ruby
<apeiros> ah, it wants a comparison
<Mon_Ouie> minmax { |a, b| f(a) <=> f(b) } is similar to minmax_by { |a| f(a) }
<allisio> `f(a) - f(b)` is equivalent to `f(a) <=> f(b)` in most cases.
<apeiros> interesting, I forgot that min/max/minmax all take a block like that
ltem has quit [Quit: Leaving]
<allisio> Well, no, maybe "equivalent" is a little strong, but it generally does The Right Thing.
BackEndCoder has joined #ruby
<apeiros> well, seems I was correct about "you want minmax_by instead of minmax", but was wrong about the "doesn't take a block" part :D
<allisio> You've got me trying to figure out where my code would go wrong.
<allisio> Heh, never mind. It's pretty much completely wrong. :<
<allisio> I definitely wanted #minmax_by.
Xiti has quit [Quit: Xiti]
derp10327 has quit [Quit: Leaving]
milardovich has quit [Remote host closed the connection]
Channel6 has joined #ruby
acalycine has quit [Quit: bye]
jgt has joined #ruby
millerti has quit [Ping timeout: 240 seconds]
MyMind has joined #ruby
hahuang61 has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
armyriad has quit [Ping timeout: 260 seconds]
Sembei has quit [Ping timeout: 260 seconds]
cyphase has quit [Ping timeout: 240 seconds]
armyriad has joined #ruby
hahuang61 has quit [Ping timeout: 264 seconds]
jgt has quit [Ping timeout: 264 seconds]
Rodya_ has joined #ruby
mooser has joined #ruby
cyphase has joined #ruby
ericx2x has quit [Remote host closed the connection]
pifon has joined #ruby
blackwind_123 has quit [Ping timeout: 268 seconds]
spicerack has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Rodya_ has quit [Ping timeout: 246 seconds]
mooser has quit [Ping timeout: 260 seconds]
blackwind_123 has joined #ruby
Xiti has joined #ruby
gloscombe_ has joined #ruby
must_modify has quit [Quit: Page closed]
bkxd has joined #ruby
Fernando-Basso has quit [Quit: WeeChat 1.7]
bkxd has quit [Ping timeout: 240 seconds]
duckpupp1 has joined #ruby
blackwind_123 has quit [Ping timeout: 268 seconds]
toretore has quit [Ping timeout: 240 seconds]
blackwind_123 has joined #ruby
ule has quit [Quit: leaving]
duckpupp1 has quit [Ping timeout: 256 seconds]
cyphase has quit [Ping timeout: 256 seconds]
alamar is now known as julian
cyphase has joined #ruby
skweek has joined #ruby
jameser has joined #ruby
fulcan has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
scorphus has joined #ruby
patarr has quit [Ping timeout: 240 seconds]
TomyLobo2 has quit [Ping timeout: 264 seconds]
dasher00 has quit [Ping timeout: 240 seconds]
BabyMario has quit [Ping timeout: 258 seconds]
julian is now known as j
BabyMario has joined #ruby
j is now known as alamar
dasher00 has joined #ruby
jameser has quit [Ping timeout: 264 seconds]
skweek has quit [Ping timeout: 240 seconds]
BackEndCoder has quit [Excess Flood]
BackEndCoder has joined #ruby
banisterfiend has quit [Quit: Textual IRC Client: www.textualapp.com]
banisterfiend has joined #ruby
marr has joined #ruby
Slinky_Pete has quit [Remote host closed the connection]
Guest96 has joined #ruby
Slinky_Pete has joined #ruby
patarr has joined #ruby
balazs_ has quit [Remote host closed the connection]
balazs has quit [Remote host closed the connection]
roring357 has joined #ruby
Slinky_Pete has quit [Ping timeout: 268 seconds]
roring357 has quit [Client Quit]
skweek has joined #ruby
marcdel has quit [Ping timeout: 260 seconds]
skweek has quit [Ping timeout: 240 seconds]
hahuang61 has joined #ruby
jgt has joined #ruby
millerti has joined #ruby
djbkd has joined #ruby
djbkd has quit [Client Quit]
hahuang61 has quit [Ping timeout: 246 seconds]
milardovich has joined #ruby
jgt has quit [Ping timeout: 240 seconds]
milardovich has quit [Remote host closed the connection]
Rodya_ has joined #ruby
kirun has quit [Quit: Konversation terminated!]
gloscombe_ has quit [Quit: gloscombe_]
blackwind_123 has quit [Ping timeout: 268 seconds]
Rodya_ has quit [Ping timeout: 246 seconds]
blackwind_123 has joined #ruby
mooser has joined #ruby
roring357 has joined #ruby
mooser has quit [Ping timeout: 240 seconds]
roring357 has quit [Quit: Mutter: www.mutterirc.com]
blackwind_123 has quit [Ping timeout: 268 seconds]
lxsameer has quit [Quit: WeeChat 1.7]
blackwind_123 has joined #ruby
BTRE has quit [Ping timeout: 240 seconds]
jameser has joined #ruby
Slinky_Pete has joined #ruby
blackwind_123 has quit [Ping timeout: 268 seconds]
pjaspers has quit [Ping timeout: 240 seconds]
pjaspers has joined #ruby
BTRE has joined #ruby
sparr has quit [Ping timeout: 240 seconds]
TheMainFrame has quit [Ping timeout: 240 seconds]
TheMainFrame has joined #ruby
blackwind_123 has joined #ruby
jameser has quit [Ping timeout: 264 seconds]
ElFerna has joined #ruby
ElFerna has quit [Client Quit]
bkxd has joined #ruby
sparr has joined #ruby
VladGh has quit [Remote host closed the connection]
bkxd has quit [Ping timeout: 268 seconds]
blackwind_123 has quit [Ping timeout: 268 seconds]
VladGh has joined #ruby
rgtk has quit [Ping timeout: 260 seconds]
blackwind_123 has joined #ruby
marcdel has joined #ruby
Slinky_Pete has quit []
blackwind_123 has quit [Read error: Connection reset by peer]
marcdel has quit [Ping timeout: 240 seconds]
hahuang61 has joined #ruby
blackwind_123 has joined #ruby
patarr has quit [Ping timeout: 240 seconds]
houhoulis has joined #ruby
hahuang61 has quit [Ping timeout: 240 seconds]
blackwind_123 has quit [Read error: Connection reset by peer]
tau has joined #ruby
rgtk has joined #ruby
blackwind_123 has joined #ruby
BTRE has quit [Ping timeout: 260 seconds]
blackwind_123 has quit [Read error: Connection reset by peer]
patarr has joined #ruby
BTRE has joined #ruby
blackwind_123 has joined #ruby
marcdel has joined #ruby
enterprisey has joined #ruby
blackwind_123 has quit [Read error: Connection reset by peer]
enterprisey_ has joined #ruby
charliesome has joined #ruby
enterprisey_ has quit [Client Quit]
danielpclark has joined #ruby