outreach_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nitric has quit [Quit: sleep]
hutch34_ has quit [Ping timeout: 258 seconds]
outreachdan has joined #ruby
domgetter has joined #ruby
Fridtjof has quit [Ping timeout: 252 seconds]
alan_w has joined #ruby
Fridtjof has joined #ruby
rgtk has quit [Ping timeout: 260 seconds]
Channel6 has joined #ruby
bkxd has quit [Ping timeout: 258 seconds]
pickle_ has joined #ruby
outreachdan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ineb has quit [Read error: Connection reset by peer]
rakm has joined #ruby
ineb has joined #ruby
outreachdan has joined #ruby
Silthias has joined #ruby
rgr_ has joined #ruby
Silthias1 has quit [Ping timeout: 260 seconds]
username1 has quit [Ping timeout: 240 seconds]
binaryplease has quit [Ping timeout: 260 seconds]
snockerton has quit [Quit: Leaving.]
mrconfused has quit [Ping timeout: 258 seconds]
SeepingN has quit [Remote host closed the connection]
mim1k has joined #ruby
gusrub has joined #ruby
gravyflex has joined #ruby
Silthias1 has joined #ruby
Silthias has quit [Ping timeout: 260 seconds]
mim1k has quit [Ping timeout: 260 seconds]
outreachdan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
esObe has joined #ruby
Verity has quit [Remote host closed the connection]
impermanence has joined #ruby
duderonomy has joined #ruby
outreachdan has joined #ruby
mooser has quit []
esObe has quit [Ping timeout: 260 seconds]
mrconfused has joined #ruby
mooser has joined #ruby
outreachdan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
maattdd has joined #ruby
mrconfused has quit [Ping timeout: 258 seconds]
bronson has quit [Remote host closed the connection]
amclain has quit [Quit: Leaving]
maattdd has quit [Ping timeout: 260 seconds]
ziarkaen has quit [Ping timeout: 260 seconds]
StoneCypher has quit [Ping timeout: 255 seconds]
juggler has joined #ruby
Rodya_ has joined #ruby
nickjj has quit [Read error: Connection reset by peer]
bronson has joined #ruby
gravyflex has quit [Quit: gravyflex]
<impermanence>
I took this code from a book. And I'm pretty sure it doesn't work because it essentially tries to open a variable (not quite sure if that's the right way to phrase it). Just want to check with the experts before I contact the author:
<impermanence>
It doesn't work for me. Either by script or in irb. But if I write() to it and then open it it works. This is of course only one solution. But either way I'm pretty sure its dead as is.
esObe has joined #ruby
pickle_ has quit [Remote host closed the connection]
<impermanence>
Sorry if this already came thru: I couldn't tell if I was connected or not.
<impermanence>
I took this code from a book. And I'm pretty sure it doesn't work because it essentially tries to open a variable (not quite sure if that's the right way to phrase it). Just want to check with the experts before I contact the author:
<cerulean>
open /Home/impermanence/development/personal/git/ruby/io/ext15_sample.txt
<cerulean>
run that
<cerulean>
if it opens the text file, the path is correct
<impermanence>
ext15_sample.txt doesn't exist. maybe his instructions say to create it.
<impermanence>
lemme check.
<cerulean>
you can't open a file that doesn't exist unless you use +w and maybe +a flags when you open it i think
<impermanence>
cerulean: I don't think his instructions say to create the file first.
<cerulean>
a - Append to a file.The file is created if it does not exist.
<cerulean>
you were lied to
<cerulean>
you can't open a nonexist file
<cerulean>
sorry just can't
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<cerulean>
unless you use a or a+ modes
jameser has joined #ruby
<cerulean>
which will create it
<cerulean>
create it with touch ex15_sample.txt
rakm_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<impermanence>
that was the problem. I didn't read his instructions carefully enough. He implies that you need to write the file first, write some stuff to it and then work with his code.
<impermanence>
k, cool.
<cerulean>
touch is an old unix command which lets you create an empty unix file
<impermanence>
cerulean: I think that was the problem. I often just read what he says once and then go to the ruby core and stdlib docs because I'm comfortable doing that.
<impermanence>
cerulean: so I always end up writing my own code which almost always doesn't follow his logic (I learn it better that way.)
<cerulean>
thats good, dont miss out on stack. authors make mistakes
<cerulean>
always google the error message
<impermanence>
cerulean: totally.
<cerulean>
always better to write your own code
<impermanence>
cerulean: yeah so I've been using fileutils and kernel and etc. etc.
<impermanence>
yep
<cerulean>
dont be like an english teacher who cant speak good english
<cerulean>
use it up, ruby is the best tool
Rodya_ has quit [Remote host closed the connection]
<impermanence>
cerulean: to his credit he got back to me and was patient. he was not a dick.
andrewvee has joined #ruby
ghornet has quit [Ping timeout: 258 seconds]
genpaku has quit [Remote host closed the connection]
<impermanence>
thanks for the second set of eyes. always a help.
* Nilium
wishes he had more eyes
genpaku has joined #ruby
jaequery has joined #ruby
<cerulean>
np
chouhoulis has quit [Ping timeout: 252 seconds]
zipkid has quit []
<cerulean>
ive used ruby since 2010
<cerulean>
so i try
zipkid has joined #ruby
chichou has joined #ruby
ghornet has joined #ruby
Channel6 has joined #ruby
pickle_ has quit [Remote host closed the connection]
pickle_ has joined #ruby
chichou has quit [Ping timeout: 258 seconds]
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<_mak>
I do not specify anything on the connection... not sure how to see the encoding for the column
lxsameer has joined #ruby
<_mak>
I connect with Mysql2::Client.new(:host => @db_ip, :username => "root", :password => @db_password)
mim1k has quit [Ping timeout: 240 seconds]
<jhass>
(MySQL allows to override the encoding and collation per column but if you didn't set anything it should inherit it from the table and if that's not set from the db)
govg has joined #ruby
<jhass>
try passing :encoding => "utf8" to the connect call too
<jhass>
and do not do any encode calls
<_mak>
ok
<jhass>
they shouldn't be necessary if you have the input with right encoding specified and the output specified with the right encoding
<_mak>
jhass: same results
<jhass>
so open the file with :encoding => "UTF-8" too
<_mak>
hmm
<_mak>
ok
<_mak>
it is actually a new file: File.new("#{json_dir}/#{table}.json","w", :encoding => "UTF-8")
<jhass>
sure that's fine
<_mak>
cool
<jhass>
open and new are just aliases
<_mak>
jhass: same issue
<jhass>
ok, time to dig into the db
<jhass>
a common issue especially with mysql is that the data was written with the wrong encoding into the db in the first place
<_mak>
I see
<_mak>
should I find out the encoding of the column then
<jhass>
so say it's UTF-8, mysql thinks it's ISO something and tries to convert the UTF-8 into UTF-8 for your connection by interpreting it as ISO something
<jhass>
stuff like this
<_mak>
right
<_mak>
I've just found out the column encoding: uft8
astrobunny has quit [Read error: Connection reset by peer]
<_mak>
jhass: what do you mean?
<_mak>
normal insert I would say
<jhass>
yeah sorry, I mean by what kind of environment
<jhass>
what programming language running on what kind of OS
<jhass>
potentially getting its input itself from where
<jhass>
also if you do a select on the mysql console does it display correctly actually?
<_mak>
ah right, it was inserted in an ubuntu OS, ruby as well (can't remember the version), the input was taken from a json API
<_mak>
I'm using a mysql client, let me check if it shows correct on the console
dhollinger has quit [Ping timeout: 260 seconds]
<_mak>
shit, I don't have the mysql client on my windows
<_mak>
I thought I could not be related to the console because it is writting incorrectly to the file as well
<_mak>
so it can't be just a matter of not being able to display it correctly
<jhass>
well, what I really want to know is whether there's anything that gets it out correctly
<jhass>
but I guess you already said its fine when you run the same script on linux?
<_mak>
yeah
<_mak>
jhass: what if I run a select on irb
<_mak>
would that be a good test?
Pumukel has joined #ruby
<jhass>
I wouldn't expect much difference tbh
<_mak>
ok then
dionysus69 has joined #ruby
<jhass>
I'd run the script in the same version as you run it on linux but with the added :encoding => params to both the connection and the file
<jhass>
and then make sure to open it in a UTF-8 aware editor on windows
<_mak>
I can't remember what version I had on the linux machine... so you say I could try installing an older ruby version to test?
<_mak>
I'm using sublime
Guest52610 has joined #ruby
<jhass>
older ruby versions generally only make encoding matters worse ;)
<jhass>
2.0 was the first one where general sanity was achieved
<_mak>
jhass: I've just noticed that if I select that row from irb the quantity of unicode chars is just one: => {"publisher_id"=>7582, "name"=>"VS Verlag f\u00FCr Sozialwissenschaften"}
<_mak>
so there must be something that is multiplying the quantity somewhere
<jhass>
mh
<jhass>
\u00FC is UTF-8 ü fwiw
<_mak>
yeah
<_mak>
so what could be converting this char into that big sequence of unicodes
<_mak>
oh man! {"publisher_id":7582,"name":"VS Verlag für Sozialwissenschaften"}
* _mak
is totally confused now :)
<jhass>
okay let's make sure it's now on how you invoke, make a new ruby script that just does the minimal stuff you did in irb and see if it's still ok when you do ruby that.rb
<jhass>
*not how
Guest52610 is now known as CrazEd
<_mak>
ok
esObe has joined #ruby
CrazEd is now known as Guest49772
<_mak>
jhass: it works correctly
<_mak>
so it must be something else in my script
<jhass>
so there's gotta be something else you do besides converting to json ;)
<_mak>
yeah
<_mak>
what could I look for
<_mak>
file.read? and stuff like that?
<jhass>
idk, that you do json conversion at all was news to me until you mentioned it ;)
<jhass>
no idea what you script really does
<_mak>
ok then, I'll try to find it
<_mak>
thanks a lot mate
<jhass>
yw
<jhass>
expanding that minimal example step by step to include all the steps you do in your real thing might be a good way forward
esObe has quit [Ping timeout: 258 seconds]
xall has quit [Ping timeout: 240 seconds]
biberu has joined #ruby
Guest24_ has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
Guest24_ has joined #ruby
mooser has joined #ruby
darwish has joined #ruby
<darwish>
Hello. Does ruby support assignment in argument list?
bronson has quit [Remote host closed the connection]
jdm has quit [Ping timeout: 260 seconds]
StoneCypher has quit [Ping timeout: 260 seconds]
antoniobeyah has quit [Quit: Connection closed for inactivity]
nomenkun has quit [Remote host closed the connection]
pankaj_ has quit [Quit: Leaving]
nomenkun has joined #ruby
mooser has joined #ruby
nomenkun has quit [Read error: No route to host]
SteenJobs_ has joined #ruby
nomenkun has joined #ruby
synthroi_ has joined #ruby
Sammichmaker has joined #ruby
yurikoles has joined #ruby
synthroid has quit [Ping timeout: 258 seconds]
CloCkWeRX has quit [Quit: Leaving.]
jdm has joined #ruby
nomenkun has quit [Quit: Leaving...]
pupsicle has joined #ruby
Jackneill has quit [Remote host closed the connection]
jdm has quit [Remote host closed the connection]
DARPA has joined #ruby
Guest74649 is now known as CrazEd
CrazEd is now known as Guest26551
esObe has joined #ruby
Arpanet69 has quit [Ping timeout: 255 seconds]
ramfjord has joined #ruby
Arpanet69 has joined #ruby
esObe has quit [Ping timeout: 240 seconds]
__Yiota has joined #ruby
singalaut has joined #ruby
DARPA has quit [Ping timeout: 268 seconds]
DARPA has joined #ruby
mooser has quit [Ping timeout: 252 seconds]
ebanoid has joined #ruby
Arpanet69 has quit [Ping timeout: 240 seconds]
gnufied has joined #ruby
JeanCarloMachado has joined #ruby
loechel has quit [Remote host closed the connection]
Pumukel has joined #ruby
Pumukel has quit [Remote host closed the connection]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Pumukel has joined #ruby
rgr_ has quit [Quit: rgr_]
Pumukel has quit [Ping timeout: 260 seconds]
Burgestrand has quit [Quit: Closing time!]
chichou has joined #ruby
arquebus has joined #ruby
<flips>
importing values from an XML file, the booleans ends up as string "true" and "false" ... Is there an easy way to "boolify" the strings? :) (Assuming it might not, as true and false are object, that might have to write a conditional test)
StoneCypher has joined #ruby
<jhass>
value = true if value == "true"; value = false if value == "false"
supergeek has joined #ruby
chichou has quit [Ping timeout: 260 seconds]
jameser has joined #ruby
arquebus has quit [Client Quit]
karapetyan has quit [Remote host closed the connection]
Mon_Ouie has joined #ruby
arquebus has joined #ruby
karapetyan has joined #ruby
bdonnahue has quit [Ping timeout: 258 seconds]
StoneCypher has quit [Ping timeout: 268 seconds]
supergeek has quit [Remote host closed the connection]
supergeek has joined #ruby
supergeek has quit [Client Quit]
nemish has joined #ruby
<elomatreb>
jhass: Or just value = value == "true"?
<jhass>
elomatreb: that assumes the only other valid value is "false"
ghornet has joined #ruby
<hanmac>
flips: what should it return if its neither true or false?
nyuszika7h has quit [Quit: Upgrading WeeChat, brb]
nyuszika7h has joined #ruby
govg has quit [Ping timeout: 252 seconds]
JeanCarloMachado has quit [Ping timeout: 260 seconds]
<flips>
Hm, I do want the field to be only true or false, boolean style. I'm saving to the xml file myself using xmlsimple (or crack, is the plan)
sleetdrop has quit [Quit: Computer has gone to sleep.]
sepp2k has quit [Read error: Connection reset by peer]
dionysus69 has quit [Ping timeout: 240 seconds]
houhoulis has joined #ruby
chouhoulis has joined #ruby
sepp2k has joined #ruby
bigkevmcd has joined #ruby
<flips>
elomatreb: That was compact syntax :) So ... value should point/be assigned to value's object if value == "true" (and then point to false if value is something else)?
<flips>
(Yep, the syntax worked very well) :)
Guest26551 is now known as CrazEd
<jhass>
it just assigns the value of the expression value == "true" back to value
<jhass>
there's no "if"
CrazEd is now known as Guest27278
<flips>
and no parenthesis :)
<jhass>
but if this is all in your hands, did you consider just using json as it has a native boolean type?
rippa has joined #ruby
<flips>
I tried asking yesterday if I should consider json, xml or haml in addition to yaml ... Now you gave me a good reason for json
bigkevmcd has quit [Client Quit]
<flips>
I'm just experimenting for learning anyways :)
<flips>
I know crack has json, but should I consider some other module/gem?
<jhass>
tbh I don't get the purpose of crack
<jhass>
how's it better than require "json"; JSON.parse
<jhass>
given json is in the stdlib
<flips>
ok, it showed up when I searched for xml parsing tools :)
<jhass>
the standard xml parsing library is nokogiri with oga gaining momentum
ghornet has quit [Ping timeout: 255 seconds]
synthroi_ has quit [Remote host closed the connection]
arquebus has quit [Quit: Leaving]
<flips>
I tried nokogiri, but ended up a very complex hash ... Russ Olsen mentions xmlsimple in his book :)
mint has joined #ruby
<jhass>
well you shouldn't use nokogiri to pull out a hash
<jhass>
but rather stick to its API as long as possible
<jhass>
using .css or .xpath to get at the nodes you want
SteenJobs_ has quit [Quit: SteenJobs_]
harfangk has joined #ruby
mooser has joined #ruby
poikon has quit []
poikon has joined #ruby
mrconfused has joined #ruby
papillom has quit [Quit: Leaving.]
karapetyan has quit [Remote host closed the connection]
mim1k has quit [Ping timeout: 260 seconds]
papillom has joined #ruby
s2013 has joined #ruby
mooser has quit [Ping timeout: 240 seconds]
jrm has joined #ruby
erlend has quit [Read error: Connection reset by peer]
Pumukel has joined #ruby
pickle_ has quit [Remote host closed the connection]
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
renchan has quit [Quit: Leaving...]
bmurt has joined #ruby
erlend has joined #ruby
govg has joined #ruby
sleetdrop has joined #ruby
shinnya has joined #ruby
ferr has quit [Quit: WeeChat 1.7]
bronson has joined #ruby
<flips>
json seems simpler for such data I'm storing :)
ineb has joined #ruby
rakm has joined #ruby
ghornet has joined #ruby
patarr has joined #ruby
t-recx has quit [Quit: t-recx]
houhoulis has quit [Remote host closed the connection]
Guest96 has quit [Quit: Guest96]
Guest96 has joined #ruby
karapetyan has joined #ruby
synthroid has joined #ruby
ghornet has quit [Ping timeout: 260 seconds]
LastWhisper____ has joined #ruby
claudevandort has joined #ruby
haraoka has quit [Ping timeout: 240 seconds]
yurikoles has quit [Read error: Connection reset by peer]
Bob8989|2 has joined #ruby
rgtk has quit [Ping timeout: 260 seconds]
millerti has joined #ruby
yurikoles has joined #ruby
ptx0 has joined #ruby
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ghornet has joined #ruby
ptx0 has quit [Ping timeout: 240 seconds]
<jhass>
more often than not it is ;)
shwouchk has joined #ruby
Guest27278 is now known as CrazEd
CrazEd is now known as Guest79343
esObe has joined #ruby
chouhoulis has quit [Remote host closed the connection]
karapetyan has quit [Remote host closed the connection]
esObe has quit [Ping timeout: 260 seconds]
mint has quit [Ping timeout: 240 seconds]
Rodya_ has joined #ruby
grh has joined #ruby
karapetyan has joined #ruby
mrconfused has quit [Ping timeout: 258 seconds]
ptx0 has joined #ruby
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mrconfused has joined #ruby
kf has joined #ruby
kf has quit [Client Quit]
ghornet has quit [Ping timeout: 240 seconds]
synthroid has quit [Remote host closed the connection]
mrconfused has quit [Ping timeout: 258 seconds]
charliesome has joined #ruby
millerti has joined #ruby
karapetyan has quit [Remote host closed the connection]
JackMc is now known as auv5
mint has joined #ruby
bigkevmcd has joined #ruby
domgetter has quit [Ping timeout: 252 seconds]
mrconfused has joined #ruby
mint has quit [Ping timeout: 255 seconds]
auv5 is now known as magic
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ghornet has joined #ruby
Guest96 has quit [Remote host closed the connection]
gsilva has joined #ruby
<allisio>
We can turn `x = x + 1` into `x += 1`, but not `x = x == other` into `x === other`, at least not in the general case.
<allisio>
Or, well, not in any case, I guess; things can't be #replace'd to booleans. :/
snockerton has joined #ruby
Guest96 has joined #ruby
SuperLag_ has joined #ruby
SuperLag has quit [Disconnected by services]
SuperLag_ is now known as SuperLag
snockerton has quit [Client Quit]
SuperLag has quit [Changing host]
SuperLag has joined #ruby
ozcanesen has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<flips>
When I do a @myhash = JSON.parse(myfile, opts...) in a class method, then @file="/path/to/myfile.json" ends up in my hash after the data I wanted (hash created by myhash = MyClass.new and myhash.load_item_from_file)
karapetyan has joined #ruby
<flips>
I assume my logic is wrong ;)
<jhass>
gist your code?
cfec0b8d has quit [Ping timeout: 252 seconds]
despai has joined #ruby
ghornet has quit [Ping timeout: 268 seconds]
mrconfused has quit [Ping timeout: 255 seconds]
joelwallis has joined #ruby
* apeiros
guesses scope confusion
<apeiros>
but yeah, code
ptx0 has quit [Quit: leaving]
ptx0 has joined #ruby
despai has quit [Client Quit]
despai has joined #ruby
karapetyan has quit [Ping timeout: 240 seconds]
jameser has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
FastJack has quit [Ping timeout: 260 seconds]
Dry_Lips has quit [Ping timeout: 255 seconds]
karapetyan has joined #ruby
gravyflex has joined #ruby
<flips>
I'm guessing that, too, I'm trying to move working code into class/subclass... ;) https://eval.in/776594 (It's a mix of other copied&pasted code, but list = List.new, and list.load_items seems to work, but list contains a layer too much or something
jameser has quit [Max SendQ exceeded]
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
Bob8989|2 has quit [Read error: Connection reset by peer]
millerti has joined #ruby
<jhass>
flips: JSON.parse is for reading json into a hash, to turn a hash back into json before writing it into a file just call .to_json on it
mrconfused has joined #ruby
millerti has quit [Client Quit]
<jhass>
however note that neither will automagically handle the nested Item class
<flips>
I haven't looked into the saving yet (it's copied and pasted/confused with code from a working array example), I thought I would learn more about hashes by rewriting it and also test json/xml etc .. So the input file looks valid and works in a plain example (no classes, just load from file and puts)
Guest79343 is now known as CrazEd
CrazEd is now known as Guest33763
HalcyonicStorm has quit []
HalcyonicStorm has joined #ruby
esObe has joined #ruby
jamesaxl has quit [Read error: Connection reset by peer]
Guest96 has quit [Remote host closed the connection]
dviola has joined #ruby
Guest96 has joined #ruby
gravyflex has quit [Quit: gravyflex]
<User458764>
Hi, I would like to modify the keys of a hash and replace every '-' by '_' how do I do that?
ghornet has joined #ruby
BSab has quit [Ping timeout: 240 seconds]
<ljarvis>
User458764: what did you try?
gravyflex has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
amclain has joined #ruby
gsilva has quit [Ping timeout: 268 seconds]
mooser has quit [Remote host closed the connection]
gsilva has joined #ruby
<User458764>
ljarvis I simplify my problem I just need to modify an array values now, does a gsub('-', '_') is a good way
<ineb>
User458764: if on rails, you have Hash#transform_keys
BSaboia has joined #ruby
<User458764>
ineb I am on rails thanks
<ineb>
User458764: for your array problem, you could do arr = arr.map {|s| s.gsub('-', '_')}
p0p0pr37 has quit [Read error: Connection reset by peer]
Xiti has joined #ruby
rakm has joined #ruby
<jhass>
no need to gsub, tr is just good enough here
jdm has joined #ruby
kassav_ has quit [Quit: kassav_]
mrconfused has quit [Ping timeout: 240 seconds]
raul782 has joined #ruby
despai has quit []
despai has joined #ruby
raul782 has quit [Read error: Connection reset by peer]
raul782_ has joined #ruby
bodgix has quit [Quit: Leaving.]
hxegon_a1k is now known as hxegon
p0p0pr37 has joined #ruby
p0p0pr37 has quit [Changing host]
p0p0pr37 has joined #ruby
yokel has quit [Ping timeout: 268 seconds]
yokel has joined #ruby
minimalism has quit [Ping timeout: 258 seconds]
magic is now known as auv5
<User458764>
Thanks for help but I think my problem is in my model I need to map the attributes with an underscore to the same but with a dash it is a Rails question :)
Rodya_ has quit [Remote host closed the connection]
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
raul782_ has quit [Remote host closed the connection]
nitric has joined #ruby
<jhass>
?rails
<ruby[bot]>
Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
raul782 has joined #ruby
<User458764>
jhass ok
FastJack has joined #ruby
<cerulean>
what is Ruby on Rails?
millerti has joined #ruby
Arpanet69 has joined #ruby
karapetyan has quit [Remote host closed the connection]
Rodya_ has joined #ruby
mazeinmaze_ has quit [Ping timeout: 240 seconds]
DARPA has quit [Ping timeout: 240 seconds]
mrconfused has joined #ruby
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest33763 is now known as CrazEd
CrazEd is now known as Guest29337
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Silthias1 has quit [Ping timeout: 260 seconds]
esObe has joined #ruby
mikecmpbll has joined #ruby
mazeinmaze_ has joined #ruby
mrconfused has quit [Ping timeout: 258 seconds]
Rodya_ has quit [Remote host closed the connection]
cbyrda has quit [Ping timeout: 252 seconds]
Silthias has joined #ruby
esObe has quit [Ping timeout: 260 seconds]
ghornet has quit [Ping timeout: 240 seconds]
millerti has joined #ruby
jgt has joined #ruby
raul782 has quit [Remote host closed the connection]
bronson has quit [Remote host closed the connection]
bronson has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
shwouchk has quit [Quit: Connection closed for inactivity]
karapetyan has joined #ruby
mim1k has joined #ruby
Snickers has joined #ruby
bodgix has joined #ruby
Xiti has quit [Quit: Xiti]
DWSR has joined #ruby
bodgix has quit [Client Quit]
<DWSR>
*Disclaimer: I'm an ops person* Hey all, I'm currently trying to build a project with Grunt, but I'm having some issues with grunt not being able to locate gems that are located in GEM_PATH. Specific output is https://gist.github.com/DWSR/b2103ce5a8dada807e6b23dbebc81c75 I know this isn't directly a ruby question, but I've already asked in #grunt, which seems dead.
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gsilva has quit [Quit: Leaving]
shwouchk has joined #ruby
shinnya has quit [Ping timeout: 258 seconds]
tubbo has joined #ruby
<tubbo>
hi folks
<tubbo>
i have a ruby application that is extremely inefficient when starting up
<tubbo>
in fact, it takes so long to start up that we have a `sleep 120` call as part of the deploy process, to give some breathing room for sidekiq to start up. it doesn't actually take 2 minutes to load, that's just a high watermark
<tubbo>
it takes about 20-45 seconds to get the app booted
<tubbo>
i would really like to improve that by compiling my .rb code into .rbc. this happens to be a rails app with lots of files, and i'm not sure how feasible that is.
cdg has quit [Read error: Connection reset by peer]
<tubbo>
this would also only happen in deployed environments, so cache_classes is on and all code is eager-loaded
<tubbo>
(actually...are .rbc files only available in Rubinius?)
gravyflex has quit [Quit: gravyflex]
millerti has joined #ruby
chichou has joined #ruby
cdg has joined #ruby
kies has quit [Ping timeout: 260 seconds]
mooser has joined #ruby
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gravyflex has joined #ruby
chichou has quit [Ping timeout: 240 seconds]
jphase has quit [Remote host closed the connection]
raul782 has joined #ruby
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
mrconfused has joined #ruby
darwish has left #ruby ["Leaving"]
mooser has quit [Remote host closed the connection]
Pumukel has quit [Remote host closed the connection]
bmurt has quit [Client Quit]
esObe has joined #ruby
tubbo has quit [Quit: get outta hee]
jameser has quit [Ping timeout: 258 seconds]
esObe has quit [Ping timeout: 260 seconds]
enterprisey has joined #ruby
alazred has quit [Ping timeout: 255 seconds]
raul782 has quit [Remote host closed the connection]
ozcanesen has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pifon has joined #ruby
claudevandort has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jamesaxl has quit [Read error: Connection reset by peer]
jamesaxl has joined #ruby
modin has joined #ruby
Guest29337 is now known as CrazEd
Dry_Lips has joined #ruby
Dry_Lips has joined #ruby
Dry_Lips has quit [Changing host]
CrazEd is now known as Guest6041
DARPA has joined #ruby
mooser has joined #ruby
millerti has joined #ruby
j2k has joined #ruby
jaequery has joined #ruby
Arpanet69 has quit [Ping timeout: 260 seconds]
<DWSR>
*Disclaimer: I'm an ops person* Hey all, I'm currently trying to build a project with Grunt, but I'm having some issues with grunt not being able to locate gems that are located in GEM_PATH. Specific output is https://gist.github.com/DWSR/b2103ce5a8dada807e6b23dbebc81c75 I know this isn't directly a ruby question, but I've already asked in #grunt, which seems dead.
mooser has quit [Ping timeout: 252 seconds]
<StoneCypher>
DWSR: why are you using an obsolete js build tool for ruby
<DWSR>
StoneCypher: I don't get to make these decisions.
<DWSR>
StoneCypher: I'm trying to get automated builds to work properly inside Atlassian Bamboo so that I can do automated deploys.
<havenwood>
saida: binding.pry into your project and check: $LOADED_FEATURES
<havenwood>
saida: can you look in that vendor dir?
Guest79606 is now known as CrazEd
CrazEd is now known as Guest79492
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<saida>
I did @havenwood but there are many gems with different versions
<saida>
havenwood: how does binding.pry work?
<havenwood>
?pry saida
<ruby[bot]>
saida: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
mrconfused has quit [Ping timeout: 258 seconds]
<havenwood>
saida: put `require 'pry'` in your code then a `binding.pry` where you want to jump to pry when you run the program
<havenwood>
or `binding.irb` with Ruby 2.4 if you prefer
galeido has quit []
Arpanet69 has quit [Ping timeout: 260 seconds]
galeido has joined #ruby
<saida>
havenwood: thanks for trying to help me, and I appreciate your help.
davic has joined #ruby
<saida>
problem here is that, it is intermittent issue, and I do not want to restart the process, as restarting it might resolve the issue
<saida>
havenwood: is there a way to check the gems path or gems used by the currently running ruby process?
mooser has joined #ruby
<havenwood>
saida: sure, you can look at the file descriptors the process is using
mrconfused has joined #ruby
<saida>
havenwood: can you please tell me how?
<havenwood>
saida: what os/distro?
<saida>
havenwood: I got it, let me try
<saida>
havenwood: thanks much, so this gives the files being used by a given process
AlexRussia has quit [Ping timeout: 258 seconds]
<matthewd>
The gems' files shouldn't still be open, though
Rodya_ has joined #ruby
<havenwood>
matthewd: good point, just stdlib would be
SeepingN has joined #ruby
JeanCarloMachado has joined #ruby
<matthewd>
Yeah, you'd get hints for any .so files, but most gems are pure .rb, so that won't help
<matthewd>
The "real" answer is probably to attach gdb and then evaluate $".. but that's not trivial
<saida>
havenwood: matthewd I see that why I dont see any
<jhass>
flips: no, @file is not part of @list anywhere
AlexRussia has joined #ruby
<jhass>
it's only part of your instance of the List class but not it's instance variable @list
karapetyan has quit [Ping timeout: 240 seconds]
karapetyan has joined #ruby
<flips>
Hm, I have trouble accessing the array/hash inside (and list.load_items also seemingly overwrote/removed the method list.add_item, when I had it defined)
<matthewd>
flips: I see no add_item method in that gist
karapetyan has quit [Remote host closed the connection]
<jhass>
also we can't hint at what you're doing wrong without seeing your attempts
<matthewd>
Are you sure it wasn't your keyboard that did the overwriting?
<jhass>
damn keyboards, always messing up the code!
<allisio>
PEBMAC.
<jhass>
let's go back to good old punching cards
bronson has joined #ruby
<flips>
I was trying to isolate one issue at the time ... so first try to fetch data from that list
mzo has quit [Ping timeout: 255 seconds]
karapetyan has joined #ruby
<saida>
matthewd: now I am at 4th step
<saida>
dont think I understood what I need to run there
jgt has joined #ruby
<matthewd>
ruby_eval('$"')
<saida>
(gdb) ruby_eval('$"') Invalid character constant.
gravyflex has quit [Quit: gravyflex]
<matthewd>
"$\"" maybe?
<flips>
jhass: in my first working program, I can fetch list[:item][2] and so on, in my attempt to structure it into classes and use methods I just get "undefined method `[]'" ... So I'm trying to understand the data structure ...
<jhass>
inside methods of your List class you can just access @list
<jhass>
if you want to access the data outside of your class you need to expose @list or operations on it through defining a method that does so
<matthewd>
flips: You haven't shown what you're running, but it sounds like `list` is now your List class -- not the hash.
chichou has quit [Ping timeout: 240 seconds]
karapetyan has quit [Remote host closed the connection]
Rodya_ has quit [Remote host closed the connection]
karapetyan has joined #ruby
esObe has joined #ruby
<flips>
Not sure what you mean I'm not showing, but as in the gist, it runs 'list = List.new' and the 'list.load_items', I'm doing that in pry and poking around. Yes, it's reported as List class (see last 2 lines), so somehow it's now an instance of the class, hm. So I need a way to expose the hash, then
Rodya_ has joined #ruby
Rodya_ has quit [Remote host closed the connection]
griff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<saida>
matthewd: I do not see any file creating in /tmp
skweek has joined #ruby
esObe has quit [Ping timeout: 268 seconds]
<saida>
matthewd: let me take it back
<saida>
I do see it
<saida>
thanks for you help matthewd really appreciate it
<matthewd>
You're welcome! Did it get you the answer you needed?
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chichou has joined #ruby
Guest79492 is now known as CrazEd
j2k has joined #ruby
CrazEd is now known as Guest91721
mooser has quit [Remote host closed the connection]
nowhere_man has joined #ruby
sagax has joined #ruby
mooser has joined #ruby
ahrs has quit [Remote host closed the connection]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ahrs has joined #ruby
FifthWall has quit [Ping timeout: 246 seconds]
BSaboia has quit [Read error: Connection reset by peer]
SeepingN has joined #ruby
jaequery has joined #ruby
FifthWall has joined #ruby
<flips>
Added some pry output to the gist, maybe that shows what happens at 'list.load_items'/why it's becoming a pointer to the Class instead of containing the hash. Thankful for any hint as to how I could/should expose/fetch the hash ... (I'm trying to learn this stuff) :)
claudevandort has joined #ruby
ben__ has joined #ruby
mim1k has joined #ruby
chrisgopher has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
ben_____ has quit [Ping timeout: 255 seconds]
swills has joined #ruby
<jhass>
flips: by adding methods to the class that work on or return @list
sepp2k has quit [Read error: Connection reset by peer]
mim1k has quit [Ping timeout: 240 seconds]
rgiscard has quit [Remote host closed the connection]
chrisgopher has quit [Remote host closed the connection]
raul782 has joined #ruby
millerti has joined #ruby
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
domgetter has joined #ruby
enterprisey has joined #ruby
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rakm has joined #ruby
raul782 has quit [Remote host closed the connection]
Xiti has joined #ruby
pilne has joined #ruby
esObe has joined #ruby
mrconfused has quit [Ping timeout: 258 seconds]
mim1k has joined #ruby
esObe has quit [Ping timeout: 260 seconds]
grh has joined #ruby
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mrconfused has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
millerti has joined #ruby
theunraveler has quit []
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
JeanCarloMachado has quit [Ping timeout: 252 seconds]
jdawgaz has joined #ruby
icarus has joined #ruby
<flips>
Adding a "return @list" to load_items didn't help/change anything, also maybe load_items should be a private method ... I need some sleep
<ovaltine>
does anyone have any gripes with 'rspec-its' or can I feel ok using it because i like it
s2013 has quit [Read error: Connection reset by peer]
shadowx has joined #ruby
jokke1 is now known as jokke
hutch34_ has quit [Ping timeout: 268 seconds]
linetrac1 is now known as linetrace
hahuang65 has quit [Read error: Connection reset by peer]
<flips>
if I do 'list2 = list.load_item' list2 gets the hash I want, so I'm not that far off, I guess ... :)
cagomez has quit []
shadowx has quit [Quit: Leaving]
swills has quit [Ping timeout: 240 seconds]
swills has joined #ruby
grh has quit [Ping timeout: 260 seconds]
karapetyan has quit []
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<matthewd>
flips: That rather defeats the point of creating a class in the first place, though
<ineb>
i usually stick with whatever the core team is suggesting.
bronson has quit [Ping timeout: 240 seconds]
steelbird has quit [Remote host closed the connection]
pupsicle has quit [Quit: pupsicle]
rakm has joined #ruby
nickjj_ has joined #ruby
esObe has quit [Ping timeout: 260 seconds]
icarus has quit [Quit: leaving]
<flips>
matthewd: yes, I feel there's some basic flaw in my logic/understanding. I wrote this program for an array based structure first, and that works nicely ... I missed something trying to convert to using a hash structure instead.
nickjj has quit [Ping timeout: 258 seconds]
outreachdan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
davic has quit [Quit: Connection closed for inactivity]
pwnd_nsfw` has joined #ruby
outreachdan has joined #ruby
rgtk has joined #ruby
outreachdan has quit [Client Quit]
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<ruby[bot]>
captain_: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<havenwood>
captain_: Use a newer version of the json gem, such as the one that shipped with your Ruby or newer.
<captain_>
thanks
<captain_>
the thing im trying to install requires that version though
chouhoulis has quit [Ping timeout: 260 seconds]
<havenwood>
captain_: bundle update json
<havenwood>
(Assuming it's an app with a Gemfile.)
kent\n has joined #ruby
shwouchk has joined #ruby
justinmcp has quit [Ping timeout: 264 seconds]
<captain_>
its more that when i bundle install it requres me to install that version of json
BTRE has quit [Remote host closed the connection]
<havenwood>
captain_: After deleting the Gemfile.lock or the less severe `bundle update json`?
baweaver is now known as baweaver_away
<havenwood>
Or more conservative yet: bundle update json --conservative
BTRE has joined #ruby
<havenwood>
captain_: The way Gemfile.lock files work is you don't get a fresh one with `bundle` or its alias `bundle install`. It installs the exact versions from the Gemfile.lock that were produced when someone first ran `bundle`.
<captain_>
i just edited it out of the gemlock
agent_white has joined #ruby
<havenwood>
captain_: One typically edits the Gemfile, then runs commands to generate or change the Gemfile.lock.