<Radar>
Well, helpa doesn't have access there so that's not going to be helpful.
<baweaver>
Ox0dea: just has to be close enough to score.
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
keen_____ has quit [Read error: Connection reset by peer]
keen_____ has joined #ruby
scripore has joined #ruby
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
ranchodev has quit [Ping timeout: 245 seconds]
helpa has quit [Remote host closed the connection]
<Aeyrix>
<Ox0dea> Radar: Sure, I just find one-day bans for such trolls to be slightly humorous. "Well, here's hoping they're a decent person come tomorrow."
<Aeyrix>
re: this
<Aeyrix>
sometimes that happens
helpa has joined #ruby
<Radar>
Not with this particular troll it doesn't.
<Aeyrix>
Also we've known that ruboto has been closed source forever, haven't we?
ishahnaz has joined #ruby
<Radar>
All I want to be able to do if ruboto is open sourced is to submit patches to ruboto to improve it
<Radar>
Just like people do with helpa
<Aeyrix>
There's only upsides to open sourcing something like an IRC bot tbh.
<bnagy>
which is all that rap but written "properly"
<bnagy>
*crap
scripore has quit [Quit: Leaving]
<sevenseacat>
ostruct is nice.
haxrbyte has quit [Remote host closed the connection]
pragmatism has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<bnagy>
we hates it precious
haxrbyte has joined #ruby
<ekleog>
ostruct = OpenStruct? Looks like exactly what I was trying to do :)
bubbys has joined #ruby
<bnagy>
ekleog: the thing with naive method missing approach is that people get tripped by by keys that are actually methods, so they don't get dispatched
<bnagy>
so you have to use basicobject or whatever
<bnagy>
or ideally Just Don't ;)
<bnagy>
cause it's slow
lele is now known as Guest24
<Ox0dea>
bnagy: Adaptive #method_missing is best #method_missing.
ejnahc has quit [Remote host closed the connection]
<bnagy>
I don't know what that is
lucyinthesky has joined #ruby
pawnbox has joined #ruby
ejnahc has joined #ruby
haxrbyte has quit [Ping timeout: 264 seconds]
howdoi has joined #ruby
<Ox0dea>
Generating "real" methods from within #method_missing.
knu has quit [Quit: Reboot...]
<Ox0dea>
It doesn't fit every use case, but it's a decent way to combat the performance hit.
<bnagy>
oic. I've done stuff like that, but you have to be pretty sure it's going to get called a few times, right?
haxrbyte has joined #ruby
<Ox0dea>
Well, sure.
frem has quit [Quit: Connection closed for inactivity]
haxrbyte has quit [Client Quit]
<bnagy>
it would be good to see benchmarks on ostruct though :)
bruno- has joined #ruby
<bnagy>
I don't know how much define_method costs
<bnagy>
I did it with some FFI stuff where creating the FFI methods was quite expensive, so I created them lazily
<Ox0dea>
Fanceh.
lucyinthesky has left #ruby ["Leaving"]
<bnagy>
was quite a big win, but the FFI stuff is kinda slow to start
livcd has quit [Read error: Connection reset by peer]
Macaveli has joined #ruby
<sevenseacat>
I saw one that said ostruct is significantly slower than plain old normal struct
<bnagy>
isn't Struct just a fussy Hash?
<sevenseacat>
kinda like ostruct :P
bruno- has quit [Ping timeout: 250 seconds]
<bnagy>
ostruct is a lazy hash
pyon has quit [Ping timeout: 246 seconds]
<bnagy>
I guess it's no lazier than a hash tbh :/
<bnagy>
just dumb syntax
<ekleog>
Unrelated: Is there a way to deny creation, except for static methods on the class?
djbkd has quit [Remote host closed the connection]
<Ox0dea>
bnagy: A cursory reading of struct.c indicates that Structs essentially store their members in a linked list.
<Ox0dea>
Which is then attached to instances via a "secret" instance variable.
<sevenseacat>
'deny creation'?
<bnagy>
Ox0dea: o_0
<sevenseacat>
ekleog: what kind of bastardization of ruby are you trying to do
<ekleog>
Like "'Blah.new' should fail"
<ekleog>
(just trying to enforce usage of factory methods)
oo_ has quit [Quit: Leaving...]
djbkd has joined #ruby
oo_ has joined #ruby
djbkd has quit [Remote host closed the connection]
yfeldblum has quit [Ping timeout: 246 seconds]
Pupp3tm4st3r has quit [Remote host closed the connection]
BTRE has quit [Ping timeout: 256 seconds]
<Ox0dea>
ekleog: Would it not suffice to make the #new class method private?
<ekleog>
I found private_class_method, but if I understood correctly, private in ruby means private including to other objects of the same class, so I guess it'd be private for static methods
<sevenseacat>
well `new` is a class method, so that seems to fall inside your 'except for static methods' misnomer
Pupp3tm4st3r has joined #ruby
pyon has joined #ruby
jeadr has quit [Remote host closed the connection]
greenarrow has joined #ruby
<Ox0dea>
ekleog: How about `alias initialize raise`?
<havenwood>
ekleog: Why? Do you want only one instance of the Class? Does something happen that means it can't be instantiated any longer?
stan has joined #ruby
jeadr has joined #ruby
<sevenseacat>
private in ruby means 'cannot be called with an explicit receiver other than self'
<sevenseacat>
afaik
Rollabunna has joined #ruby
<havenwood>
elaptics: If you don't need even one instance just use a Module.
<havenwood>
elaptics: oops, mt
<havenwood>
ekleog: ^
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dionysus69 has joined #ruby
casadei_ has quit [Remote host closed the connection]
<sevenseacat>
Ox0dea: ooooh so no explicit receiver at all? ah hah
ramfjord has joined #ruby
<Ox0dea>
Oui.
<havenwood>
I think when I see "factory" my brain goes blank for a few seconds.
Pupp3tm4st3r has quit [Remote host closed the connection]
rdark has joined #ruby
hololeap has quit [Ping timeout: 246 seconds]
<ekleog>
sevenseacat: I was about to say I'm unable to call new from a static method. Then I saw Ox0dea's answer and tried without the class name in front and it worked. Thanks all!
knu has joined #ruby
<Ox0dea>
Wait, what?
<sevenseacat>
I have no idea whats going on anymore.
<Ox0dea>
I don't recall offering any good advice on this matter.
* sevenseacat
goes back to poking Rails app
hololeap has joined #ruby
<ekleog>
Well, I tried using private_class_method and to do MyClass.new inside the factory functions and it didn't work. Then I saw the feature request, and I tried using only "new", which worked :)
<ekleog>
s/to do/doing/
BTRE has joined #ruby
psy_ has quit [Quit: Leaving]
<ledestin>
there was a gem making calling of external processes a breeze
<Ox0dea>
shellox: Well, they're escaping \ to \\/ and special characters to \\u00XX, where the XX is the ordinal value of the character in hexadecimal.
<Ox0dea>
#gsub should suffice.
<Ox0dea>
*escaping /
AlexAltea has quit [Quit: Leaving]
leat has joined #ruby
<Ox0dea>
Actually, they're only escaping < and >, but #gsub is still probably the cleanest approach.
<shellox>
i tried str.decode("UTF-8")
<Ox0dea>
Why?
<shellox>
but but it returns NoMethodError: undefined method `decode' for #<String:0x007ffcd448f390>
<shellox>
uhm, i just try to get "normal" html" out
<Ox0dea>
It's not encoded; it's escaped.
<Ox0dea>
You have to unescape it.
matcouto has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<shellox>
ic. so what would your approach be to unescape all \u chars?
<Ox0dea>
See above?
<shellox>
gsub means i need to replace them one by one?
terlar has joined #ruby
<shellox>
do you know a library which can detect all of them and unescape?
<Ox0dea>
I know of a method which can do so.
<shellox>
that's also fine, would you mind sharing it?
<Ox0dea>
#gsub.
<shellox>
but that means i need to replace one by one right?
<Ox0dea>
Of course not.
<Ox0dea>
The "g" in #gsub is "global".
<shellox>
i mean for different ones \u003c, \u003e etc.
pawnbox has joined #ruby
opensource_ninja has joined #ruby
<Ox0dea>
#gsub takes an optional block in which you can muck with matches to your heart's content.
symm- has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
* apeiros
thinks the resulting output might also be a consequence of improper processing beforehand
<Ox0dea>
shellox: Okay, then you do in fact have double backslashes in the string.
pawnbox has quit [Ping timeout: 260 seconds]
blackmesa has joined #ruby
<Ox0dea>
(Which is kind of weird.)
Newbie0086 has joined #ruby
dgutierrez1287 has joined #ruby
<Ox0dea>
shellox: Did that #gsub example help clarify how you might approach this, then?
ght has quit [Ping timeout: 260 seconds]
closer has quit [Ping timeout: 272 seconds]
conor_ has joined #ruby
pawnbox has joined #ruby
charliesome has joined #ruby
workmad3 has joined #ruby
closer has joined #ruby
np0 has quit [Ping timeout: 246 seconds]
<shellox>
Ox0dea: yep, think i got it. thanks
dgutierrez1287 has quit [Ping timeout: 240 seconds]
<Ox0dea>
shellox: If it's the case that you *don't* actually have double backslashes (on which I think apeiros' judgment was sound), you should be able to just pass the string through CGI.unescape.
<wasamasa>
that's like asking how you can know whether you're in love
<wasamasa>
you just do it, duh
<wasamasa>
*know
pengin has joined #ruby
<yorickpeterse>
well, knowing whether you're in love or not is pretty easy to figure out
pawnbox has quit [Ping timeout: 260 seconds]
lxsameer_ has joined #ruby
<gregf_>
hexadecimal: not trying to deter you :/, but qualifications are now being used to filter candidates :/. so why not study and work .. prolly the open uni ;)
<yorickpeterse>
lol
pen-soldier has joined #ruby
rahult has joined #ruby
<yorickpeterse>
There might be some jobs where a degree is preferred, or required, but it certainly isn't the norm
sameerynho has quit [Ping timeout: 260 seconds]
<hexadecimal>
so do you guys believe a degree is essential to get a career as a programmer. im at uni atm but just interested
<gregf_>
hexadecimal: no . no really
<yorickpeterse>
hexadecimal: depends on your field
<gregf_>
s/no/not/
<yorickpeterse>
e.g. if you're heading to the medical or financial sector, maybe
five27 has joined #ruby
five27 has quit [Client Quit]
<gregf_>
hexadecimal: to get a job as a doctor or a solicitor you 'surely' need a degree in the specific field. not so in computer science. but yeah, if you have a numerical/computing degree it sure does help
<wasamasa>
hexadecimal: it helps
<gregf_>
yorickpeterse: finance sector, not really. i've started of in Investment banking and no not everyone in IT 'has' a degree
<yorickpeterse>
hence I said "maybe"
<gregf_>
;)
oo_ has quit [Remote host closed the connection]
pengin has quit [Remote host closed the connection]
sevenseacat has quit [Ping timeout: 244 seconds]
Karpah has joined #ruby
opensource_ninja has quit [Quit: opensource_ninja]
pawnbox has joined #ruby
np0 has joined #ruby
astrobunny has joined #ruby
mistermocha has joined #ruby
<gregf_>
hexadecimal: for working on PHP you dont need even need brains :/
<jhass>
you mean having a brain would be harmful in achieving anything
<gregf_>
haha, cuz some of the php dudes think they know so much, their brains would fall off from the middle :/ srsly
<apeiros>
can we have the bashing in #ruby-offtopic?
<gregf_>
apeiros: ;), sorry about that
Karpah is now known as sevenseacat
vidbina has joined #ruby
mistermocha has quit [Ping timeout: 240 seconds]
eminencehc has joined #ruby
sideshowcoder has joined #ruby
rahult has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
c0m0 has joined #ruby
<hexadecimal>
im quite new to ruby and programming... would i be better off learning ruby before rails ?
eminencehc has quit [Ping timeout: 246 seconds]
Me1 has joined #ruby
<sevenseacat>
most definitely.
workmad3 has joined #ruby
duncannz has quit [Remote host closed the connection]
ramfjord has quit [Ping timeout: 255 seconds]
Kero has quit [Quit: Lost terminal]
Newbie0086 has quit [Quit: 离开]
oivoodoo has joined #ruby
oo_ has joined #ruby
<oivoodoo>
Hi everyone. Could someone help me to understand WeakRef and when we should use it? Lets say I am having sidekiq process where I am loading for processing about 100mb file I want to make sure that GC free the memory at the end. Could I use WeakRef to wrap `content`(100mb) and then make GC.start at the end of the sidekiq process?
Me1 has quit [Ping timeout: 240 seconds]
Kero has joined #ruby
<oivoodoo>
Is it possible to have in MRI GC.start in the middle of the processing 100mb data in the sidekiq process?
<Mon_Ouie>
As far as I can see from this, that example will simply fail if the GC claims 'content' while you're still using it (which can happen, if you only have a weak reference to it)
<oivoodoo>
:) I don't think so. I worked with Ruby a lot of years but I haven't used WeakRef )
vidbina_ has joined #ruby
<Mon_Ouie>
I just don't know what you're trying to achieve
Pupp3tm4st3r has quit [Remote host closed the connection]
<oivoodoo>
ok. do you know the examples when it's possible to use WeakRef? Lets say in my example probably it's better to leave as it is
shoutsid has joined #ruby
Pupp3tm4st3r has joined #ruby
vidbina has quit [Ping timeout: 272 seconds]
rahult has joined #ruby
oo_ has quit [Remote host closed the connection]
<Mon_Ouie>
I don't know of many practical uses for them, no. Debugging tools may benefit from holding on to an object as long as it is alive without preventing it from being collected.
_blizzy_ has joined #ruby
<oivoodoo>
thank you! it looks like it's overhead in my situation.
oo_ has joined #ruby
pawnbox has quit [Read error: Connection reset by peer]
dgutierrez1287 has joined #ruby
Pupp3tm4st3r has quit [Remote host closed the connection]
_blizzy_ has quit [Read error: Connection reset by peer]
chipotle has joined #ruby
rahult has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pawnbox has joined #ruby
ndrei has quit [Ping timeout: 272 seconds]
dgutierrez1287 has quit [Ping timeout: 260 seconds]
Gmi has joined #ruby
bnizzle has joined #ruby
_blizzy_ has joined #ruby
blackmesa has quit [Ping timeout: 250 seconds]
hmsimha_ has quit [Ping timeout: 265 seconds]
techsethi has quit [Quit: techsethi]
bronson has joined #ruby
nuttermb is now known as thermatix
roolo has joined #ruby
bronson has quit [Ping timeout: 250 seconds]
techsethi has joined #ruby
michael_mbp has quit [Excess Flood]
roolo has quit [Ping timeout: 250 seconds]
_blizzy_ has quit [Ping timeout: 260 seconds]
michael_mbp has joined #ruby
krz has quit [Ping timeout: 265 seconds]
stamina has joined #ruby
Rickmasta has joined #ruby
The_Phoenix has quit [Ping timeout: 252 seconds]
<ashleyhindle>
I fixed rake test hanging by running 'spring stop'
oo_ has quit [Remote host closed the connection]
<sevenseacat>
fucking spring
sdothum has joined #ruby
terlar has quit [Ping timeout: 250 seconds]
devoldmx has joined #ruby
Rickmasta has quit [Ping timeout: 244 seconds]
ndrei has joined #ruby
oddalot has joined #ruby
<oddalot>
anyone know the rails channel name?
<oddalot>
i tried to join #rails and it sent me to some namespace channel.
sameerynho has joined #ruby
<Ox0dea>
?rails oddalot
<ruboto>
oddalot, Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
<oddalot>
ahhh, thanks
<Ox0dea>
Sure thing.
radgeRayden has quit [Ping timeout: 246 seconds]
devoldmx has quit [Ping timeout: 255 seconds]
lxsameer_ has quit [Ping timeout: 245 seconds]
platzhirsch has joined #ruby
sarkyniin has joined #ruby
<thermatix>
why is every other ruby channel so dead?
<hexadecimal>
cause this one is the best
<platzhirsch>
every other?
<platzhirsch>
This is the ONE
leafybasil has quit [Remote host closed the connection]
<thermatix>
rubyonrails, siantra, opal, etc
leafybasil has joined #ruby
<thermatix>
I ask a question and I get no response
<thermatix>
nothing
<ljarvis>
because of the time of day
<hexadecimal>
ruby on rails is pretty active ?
Gmi has quit [Quit: Leaving...]
<thermatix>
does any one know how to use opalrb?
<ljarvis>
?anyone
<ruboto>
Just ask your question, if anyone has or can, they will respond.
<hexadecimal>
whats the coolest thing everyone has programmed ?
<jhass>
linux
<ljarvis>
hexadecimal: that's broad enough to be in #ruby-offtopic I think
<thermatix>
@ruboto I have, and no one responded they jsut ignored my question
<thermatix>
just*
<Ox0dea>
> @ruboto
<oddalot>
never heard of opalrb, don't know why you would want to convert ruby to javascript
matcouto has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jhass>
?justabot
<ruboto>
I'm just a bot. You don't need to address me.
<oddalot>
why not just write out javascript lol
<ljarvis>
because javascript
<thermatix>
becuase I like ruby and I don't like javascript
<oddalot>
good point
<Ox0dea>
thermatix: Why's that?
np0 has quit [Ping timeout: 244 seconds]
rahult has joined #ruby
<Ox0dea>
Lemme guess: surface syntax?
<thermatix>
no,
<thermatix>
it's the whole
<oddalot>
doesn't matter if you don't like it though, languages are very well optomized for translation
<Ox0dea>
The whole... what?
<oddalot>
are NOT* very well
<thermatix>
functions arn't just functions but objects and other stuff at the same time
<Ox0dea>
Wat.
<ljarvis>
wat
<oddalot>
it
Gmi has joined #ruby
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<thermatix>
I mean sure it means you can pass a function as an argument (for things like callbacks)
<oddalot>
it's seriously seems like trying to force a square peg in a round hole
<thermatix>
But I'd just use a yield or a proc.call
eGGsha has joined #ruby
<ljarvis>
:/
<oddalot>
just learn to embrace the circle
<thermatix>
the circle?
<ljarvis>
first-class functions are the one thing that i *wish* was in Ruby; that's an odd thing to prefer Ruby with
<Ox0dea>
^
<oddalot>
yes
<oddalot>
the circle of life
<ljarvis>
I'll take my parens any day
<ljarvis>
i aint afraid()
<bhaak>
of all the shitty things in javascript, you pick the one that isn't :)
<thermatix>
sorry but
<thermatix>
I just don't like it
<bhaak>
you could have just said '==' to show what madness reigns in js
skydiver has quit [Ping timeout: 250 seconds]
<oddalot>
(function () { console.log("javascript ain't that bad"); }());
towski_ has joined #ruby
Pupp3tm4st3r has joined #ruby
<thermatix>
I like having a class that I can then use to instantiate objects
<apeiros>
thermatix: you can do that in js
<ljarvis>
javascript has that too. Anyway, we're getting off topic
<thermatix>
true
<thermatix>
so
<thermatix>
any one know opalrb?
<thermatix>
:D
<oddalot>
JavaScript has multiple ways to do that in fact.
<ljarvis>
?anyone thermatix
<ruboto>
thermatix, Just ask your question, if anyone has or can, they will respond.
<ljarvis>
again
<oddalot>
bbl peace
lxsameer_ has joined #ruby
_blizzy_ has joined #ruby
user1138 has quit [Remote host closed the connection]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<apeiros>
ljarvis: what about sigils instead of explicit parens? i.e. in my toy language, .foo -> call the method "foo", :foo -> retrieve the method instance
user1138 has joined #ruby
user1138 has quit [Remote host closed the connection]
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sameerynho has quit [Ping timeout: 246 seconds]
ndrei has quit [Ping timeout: 245 seconds]
towski_ has quit [Ping timeout: 240 seconds]
jgt has joined #ruby
<ljarvis>
apeiros: Interesting. I think that's nice, though I would still prefer the latter myself.
sameerynho has joined #ruby
_blizzy_ has quit [Read error: Connection reset by peer]
<apeiros>
"the latter" = explicit parens?
<ljarvis>
yeah
<apeiros>
the one thing I learned when working on my toy language: avoiding sigil noise is *very* difficult
<mikecmpbll>
didn't look that big in my terminal :p
<jhass>
sigh, "openssl.so"
<mikecmpbll>
anyways, not >3 lines of text, rules abided by!
Me1 has joined #ruby
<jhass>
for me it's a full path
BackEndCoder has joined #ruby
<mikecmpbll>
so that file exists somewhere on my system, i should be able to find it
<mikecmpbll>
sec
<jhass>
but anyway, looks like ruby sticks to the .so extension
<suchness>
Does anyone know of some gems that add before and after hooks to instance methods?
s00pcan has quit [Ping timeout: 260 seconds]
<suchness>
I just finished one, but I am curious to look at other implementations now.
<apeiros>
I thought $" by now only contained full paths anymore? :-O
mistermocha has joined #ruby
<apeiros>
s/full/absolute/
<apeiros>
annoying that there's obviously still exceptions
ldnunes has joined #ruby
<Porfa>
hello
<jhass>
?crosspost suchness
<ruboto>
suchness, Please do not crosspost without at least telling so and mentioning provided suggestions and their outcome in all channels. Experience shows that people don't do either, and not doing so is considered rude.
s00pcan has joined #ruby
Norelec has joined #ruby
<suchness>
Jesus
<jhass>
Eris
que_ has quit [Quit: Page closed]
<apeiros>
mikecmpbll: hm, odd, I'm on osx too (rvm ruby) and I get openssl.bundle with absolute path
bruno- has joined #ruby
<mikecmpbll>
apeiros: seems like something's fucked up doesn't it? just testing other rubies now, 1 sec
<jhass>
RVM \o/ because consistent environments!
chills42 has quit [Remote host closed the connection]
<apeiros>
mikecmpbll: oh, ruby 2.1 I get openssl.so too
<[k-_>
could it be that they are just representing the "new" form on the page?
devoldmx has joined #ruby
<[k-_>
afaik, form fields are reset when you submit them
casadei_ has quit [Ping timeout: 260 seconds]
<[k-_>
you can try doing it in the browser
<Porfa>
i've done it in the browser, the data is inserted into the db :(
jerius has joined #ruby
astrobunny has joined #ruby
allcentury has quit [Ping timeout: 265 seconds]
but3k4 has joined #ruby
ccooke_ is now known as ccooke
d10n-work has joined #ruby
devoldmx has quit [Ping timeout: 240 seconds]
dhjondoh has quit [Ping timeout: 260 seconds]
<[k-_>
i thought you were wondering why the fields are emptied for the instance returned by Mechanize o_O
millerti has joined #ruby
<Porfa>
na, I'm wondering why the fields are empty in the database, if i manually fill the forms using the page mentioned in the script, they work just fine :)
Pathfinder has joined #ruby
hahuang65 has quit [Ping timeout: 252 seconds]
mjburgess has joined #ruby
sameerynho has joined #ruby
<Porfa>
here, more simple… :) it's not working, i can't understand why
pawnbox has quit [Remote host closed the connection]
lxsameer_ has quit [Ping timeout: 252 seconds]
ljt has joined #ruby
gagrio has joined #ruby
oo_ has joined #ruby
tkuchiki has joined #ruby
hinbody has joined #ruby
zenguy_pc has quit [Ping timeout: 260 seconds]
<jhass>
Porfa: if everything else fails get mitmproxy and compare the requests
<Porfa>
jhass: whats everything else? (looking into that mitmproxy )
zenguy_pc has joined #ruby
<jhass>
idk, ideas others might have :P
hahuang65 has joined #ruby
jerius has quit [Quit: /quit]
<Porfa>
did you look into the script?
<jhass>
I'm not much of a mechanize expert
<Porfa>
because as a first time mechanizing this is a pain, because i can't understand if I'm doing something word, or if it's something else that's stoping the data to get though
<Porfa>
through* ok
bhorn1|away is now known as bhorn1
sdothum has quit [Ping timeout: 240 seconds]
robh71 has joined #ruby
<mikecmpbll>
is it your own site that you're using mechanize against?
northfurr has joined #ruby
blackmesa has joined #ruby
<mikecmpbll>
apeiros, jhass: fwiw, there's no openssl.so file on my whole macbook so not sure why it was reporting that
<mikecmpbll>
i'm just gunna try reinstall that ruby now.
<jhass>
wat
<apeiros>
I wonder whether it's directly compiled with it
<apeiros>
enumerable.so worked that way
<apeiros>
was listed in $"
JoshL has joined #ruby
<apeiros>
but was loaded with ruby itself
ljt has quit [Read error: Connection reset by peer]
<apeiros>
hm, nope. not loaded at boot.
IceyEC has joined #ruby
<jhass>
then otool -L $(which ruby) should list a link against openssl I guess
<apeiros>
errr, enumerator.so
northfurr has quit [Client Quit]
kr3ssh has joined #ruby
<ljarvis>
Porfa: print the form object before you submit it, it'll show you the values
<apeiros>
weird
northfurr has joined #ruby
<Porfa>
mikecmpbll: yes it is
<Porfa>
ljarvis: how to print the form?
<mikecmpbll>
Porfa: then just debug from the server side? what request is being received, with what params?
<ljarvis>
Porfa: puts form.inspect
allcentury has joined #ruby
<yorickpeterse>
or just `p form`
lordkryss has joined #ruby
amystephen has joined #ruby
northfurr has quit [Client Quit]
pawnbox has joined #ruby
Macaveli has joined #ruby
Macaveli has quit [Client Quit]
<Porfa>
if i puts form.inspect, it's empty
<ljarvis>
Porfa: I said before you submit it
blackmesa has quit [Ping timeout: 250 seconds]
<Porfa>
oh.. it's not empty, it contains the values i want
<adaedra>
livcd: what do you mean? With what kind of access?
dopamean_ has joined #ruby
chills42 has joined #ruby
The_Phoenix has joined #ruby
whippythellama has joined #ruby
<[k-_>
?ot livcd
<ruboto>
livcd, this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
allcentury has joined #ruby
The_Phoenix has quit [Max SendQ exceeded]
pauly_oc has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
riotjones has quit [Remote host closed the connection]
<jhass>
that version is EOL btw
<shevy>
livcd via ruby ftp you could
arup_r has quit [Remote host closed the connection]
<jhass>
why is it gem19 but not ruby19?
The_Phoenix has joined #ruby
The_Phoenix has quit [Max SendQ exceeded]
lxsameer_ has quit [Ping timeout: 264 seconds]
Pathfinder has quit [Quit: Pathfinder]
chills42 has quit [Read error: Connection reset by peer]
<dostoyevsky>
jhass: just checked, ruby and gem are the same binaries as ruby19 and gem19... i'd say that's just because potentially gentoo can have several versions of ruby installed
chills42 has joined #ruby
chills42 has quit [Read error: Connection reset by peer]
The_Phoenix has joined #ruby
beef-wellington has joined #ruby
<jhass>
I think you might want to take this to #gentoo, sounds like something distro specific gone wrong
rmrrn has joined #ruby
chills42 has joined #ruby
Pupp3tm4st3r has quit [Remote host closed the connection]
chills42 has quit [Remote host closed the connection]
j3r0 has quit [Ping timeout: 264 seconds]
chills42 has joined #ruby
gagrio has joined #ruby
<[k-_>
i read: "sounds like something disastrous specific gone wrong" :o
rbennacer has joined #ruby
roolo has joined #ruby
lannonbr has quit [Quit: WeeChat 1.2]
oo_ has joined #ruby
mistermocha has joined #ruby
jbw has quit [Ping timeout: 244 seconds]
skydiver has joined #ruby
Pupp3tm4st3r has joined #ruby
<shevy>
versioning in executables makes me sad
roolo has quit [Ping timeout: 250 seconds]
mephistophocles has quit [Remote host closed the connection]
jbw has joined #ruby
darkf has quit [Read error: Connection reset by peer]
sevenseacat has quit [Quit: .]
darkf has joined #ruby
oivoodoo has quit [Remote host closed the connection]
<dostoyevsky>
shevy: very useful with python, as python27 and e.g. python3 are very different... so that helps a lot when running old or new scripts
bhorn1 is now known as bhorn1|away
casadei_ has joined #ruby
skydiver has quit [Ping timeout: 250 seconds]
mistermocha has quit [Ping timeout: 246 seconds]
foureight84_ has joined #ruby
<shevy>
dostoyevsky nope, absolutely useless - see gobolinux how to do it proper for all programs
ferhaty has quit []
mleung has joined #ruby
mary5030 has joined #ruby
yalue has quit [Ping timeout: 265 seconds]
<ddv>
well they just make a million symlinks :p
freezevee has quit [Remote host closed the connection]
<shevy>
yeah
<shevy>
not so many alternatives possible though
<shevy>
debian has it for some in /etc/alternatives/
<adaedra>
freebsd's default can be set in /etc/make.conf for ports
<shevy>
perhaps one could do it via fusefs/unionfs, I think then you could avoid the symlinks altogether but I am not sure
<adaedra>
the short while I was under Solaris, there was the module system
yalue has joined #ruby
<shevy>
what is that? is there a ruby module?
<adaedra>
that was weird
<shevy>
at work I used a module-loader thing, it loaded ruby into userspace and set up everything for it, and if one does no longer need it, one could unload that ruby module again
jeremy04 has quit [Remote host closed the connection]
jeremy04 has joined #ruby
dgutierrez1287 has joined #ruby
Guest63296 has joined #ruby
bruno- has joined #ruby
chills42 has quit [Remote host closed the connection]
axl_ has joined #ruby
<Porfa>
hey
<Porfa>
good afternoon
devoldmx has joined #ruby
<adaedra>
hej
<Porfa>
i need some help understanding and fixing a simple form fill script I'm trying to do, ruby + mechanize
<Porfa>
i guess the form isn't being submitted by some reason
<adaedra>
?context
<ruboto>
Please add more context to your question, what are you doing, why are you doing it, which libraries are involved. Post some code to gist if it clarifies your question.
tkuchiki_ has quit [Remote host closed the connection]
<yorickpeterse>
optparse finally catching up to the rest of the world
Rico has joined #ruby
<Rico>
hello
<Rico>
I'm trying to install rails for ruby 1.8.7 (no comment)
<mutuma>
Rico: Why 1.8.7?
chills42 has joined #ruby
<jhass>
doing some archaeology, eh?
<mutuma>
jhass: Hahahhahahaha
<Rico>
mutuma: prerequisite for a client (migration test platform)
<Rico>
jhass: héhé
tkuchiki has joined #ruby
<Rico>
is there a way to do that ?
<jhass>
gem install rails -v 3.2 or whatever?
_blizzy_ has joined #ruby
<mutuma>
gem install rails -v=VERSION
<Rico>
MuffinPimp: ok thanks a lot, jhass too
<mutuma>
but rails 4 does not support 1.8
<Rico>
s/ MuffinPimp / mutuma
bernardio has joined #ruby
mutuma is now known as Pathfinder
umgrosscol has quit [Remote host closed the connection]
JakFrist has joined #ruby
aganov has quit [Remote host closed the connection]
ruurd has quit [Quit: ZZZzzz…]
<Pathfinder>
Rico: Use rails 3.2
<Rico>
ok
whiteline has quit [Quit: Leaving]
chills42 has quit [Read error: Connection reset by peer]
<Rico>
Pathfinder: I'll try
AxonetBE has joined #ruby
chills42 has joined #ruby
<Porfa>
ljarvis: hey i submitted the gist with now "submit" before, can you comment if you have the time?
<Pathfinder>
Porfa: What’s up?
MatrixBridge has quit [Remote host closed the connection]
M-mistake has quit [Remote host closed the connection]
M-prosodyContext has quit [Remote host closed the connection]
_blizzy_ has quit [Read error: Connection reset by peer]
<Porfa>
i need to fill and submit a form, the form is mine, and hosted in my server. i think I'm doing everything fine with mechanize but still.. the form isn't getting uploaded to the DB
siempref_ has joined #ruby
astrobunny has quit [Remote host closed the connection]
conor_ has quit [Remote host closed the connection]
symm- has joined #ruby
jeadr has quit [Remote host closed the connection]
_blizzy_ has joined #ruby
siemprefresco has quit [Ping timeout: 260 seconds]
lannonbr has quit [Quit: WeeChat 1.2]
riotjones has joined #ruby
kannan4k has quit [Quit: Lost terminal]
jeadr has joined #ruby
jtdowney_ has quit [Quit: ZNC]
jtdowney has joined #ruby
jtdowney has joined #ruby
Coldblackice has quit [Ping timeout: 272 seconds]
jtdoncas has joined #ruby
<Pathfinder>
Porfa: Are you sure those are the valid names of the form
conor_ has joined #ruby
j4cknewt has joined #ruby
<Porfa>
Pathfinder: according to the html yes
mandarinkin has quit [Ping timeout: 260 seconds]
chills42 has quit [Quit: Leaving...]
riotjones has quit [Ping timeout: 244 seconds]
M-mistake has joined #ruby
M-prosodyContext has joined #ruby
<Pathfinder>
Porfa: How about you do f.DATAHORA = ‘2342’
<bweston92>
I have a quick deployment script which needs to listen to a web hook, what's the smallest library that would allow me to listen to http requests?
Axy has joined #ruby
multiscan has quit [Remote host closed the connection]
Pupp3tm4st3r has quit [Remote host closed the connection]
eminencehc has joined #ruby
<jhass>
bweston92: use == not ===, == is the stronger version in Ruby
<bweston92>
Oh ok and that is why?
<jhass>
bweston92: and you can't use return inside a Proc, just make that an if / else
<bweston92>
Ah ok
<bweston92>
weird
<bweston92>
because surly it returns anyway?
Oka_ has joined #ruby
whiteline has quit [Remote host closed the connection]
Oka has quit [Read error: Connection reset by peer]
<Porfa>
shevy: i've added a form.submit but the end of the loop, it just "reloads" the page
<jhass>
return is for methods, you're passing a block to Proc.new, return returns from the method defining the block (none here, hence illegal), break returns from the method calling the block and next returns from the block
whiteline has joined #ruby
<atmosx>
hello
whiteline has quit [Remote host closed the connection]
<shevy>
Porfa hmm
thermatix has joined #ruby
<atmosx>
How would you go about for measuring the uptime (internet connection actually) of an ADSL machine? Write a script that ping's every 1 minute or so, collect the log file and gather data...?
<bweston92>
jhass: Last real question, anyway I can start a new process within that request but don't wait for it to finish and return that 200?
<jhass>
Yes, Kernel#spawn
hobodave has joined #ruby
<Porfa>
atmosx: id get into the router and check the connection uptime
kristofferR has joined #ruby
<atmosx>
Porfa: hm, you mean login into the router via cli and get the uptime?
darkf has quit [Quit: Leaving]
<Porfa>
yeah
<atmosx>
yeah but the router works fine, it's the ADSL connection that sucks big time
<Porfa>
if it's possible… if its not, id probably use the time difference between IP changed to account that as a "internet reset" dunno if you have dynamic or static ups though..
<Porfa>
but the router has a "DIAL UP" confg thing, because ADSL still needs dial up
nuttermb has joined #ruby
<atmosx>
it has a pppoe interface
<Psi-Jack>
Eh? ADSL doesn't "dial" anything.
<Psi-Jack>
It's PPPoE over ATM switches.
<atmosx>
Psi-Jack: seriously?
<Psi-Jack>
Seriously.
lapide_viridi has quit [Quit: Leaving]
<atmosx>
Psi-Jack: you sure?
<Porfa>
I'm sorry, it's just that every time i used adsl form difernte providers here in this country, you need to dial up a USERNAME + password
<Porfa>
to make a connection
<atmosx>
Porfa: I know
<Porfa>
now these days, the modem does that on it's own
mephistophocles has joined #ruby
<atmosx>
it's the same everywhere. I use PPPoE, the ISP's router acts as a bridge
<Porfa>
Modem/router and in the page where you have the "user + password" there's usually a uptime there ;)
<ght>
Question: Anyone familiar with what the syntax might be for utilizing the |response, request, result, &block| format with RestClient in Ruby on POST or PUT statements?
<ght>
It's working fine when using on GET, and there are dozens of examples when using GET
<Psi-Jack>
PPPoE of course can do authentication, but there's no "dialing", no DTE.
<ght>
but I can't determine the syntax for POST or PUT
<atmosx>
Porfa: Yeah, I get that too, but I wanna generate graphics.
thmzlt has joined #ruby
codecop has quit [Remote host closed the connection]
<atmosx>
come to think of it, openwrt should have some sort of package for this
<ght>
And because of this RestClient is throwing exceptions with 4XX HTTP codes on POST, and I could encase the entire thing in a Begin Rescue block
pawnbox has quit [Remote host closed the connection]
thermatix has quit [Ping timeout: 265 seconds]
michaeldeol has joined #ruby
pauly_oc has joined #ruby
kies has quit [Ping timeout: 240 seconds]
<atmosx>
Psi-Jack: okay
Ropeney has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
umgrosscol has joined #ruby
dfockler has joined #ruby
mephistophocles has quit [Ping timeout: 246 seconds]
cschneid_ has joined #ruby
psy_ has joined #ruby
<Porfa>
i've noticed something in my mech a script… when it refreshes the page, it displays the page as empty, it shouldn't.. it should say "frm entered successfully"
<Porfa>
it doesnt… hmm
banister has joined #ruby
flou has joined #ruby
banister has quit [Client Quit]
yardenbar has quit [Quit: Leaving]
northfurr has quit [Quit: northfurr]
symm- has quit [Quit: Leaving...]
pawnbox has joined #ruby
symm- has joined #ruby
jds has joined #ruby
ndrei has joined #ruby
tkuchiki has quit [Remote host closed the connection]
<shevy>
Porfa perhaps you need to send some identifier in your header
Cache_Money has joined #ruby
pdoherty has joined #ruby
bernardio has quit [Ping timeout: 264 seconds]
<devdazed>
when including a module, is it possible to have the class it is getting included in evaluated first? the module I am including does an "alias_method" and the methods it is aliasing have yet to exist. I can put the call in the bottom of the class but that really looks awkward
<devdazed>
basically, the pattern is "include Instrumenter" then "instrument :somemethod"
<devdazed>
the "instrument" method is the one doing the aliasing
<devdazed>
it aliases the method getting instrumented to "old_method_name" and calls out to it in the wrapped instrumented method
rehat has quit [Remote host closed the connection]
<shevy>
devdazed not sure if this is possible, perhaps someone else here knows, but I think include adds on top of the hierarchy chain, so it gets a superclass, which I think always has to get evaluated first. there are some hooks though, inheritance-hooks
vt102 has quit [Remote host closed the connection]
DroidBurgundy has joined #ruby
mephistophocles has joined #ruby
ruurd has quit [Quit: ZZZzzz…]
joonty has quit [Quit: joonty]
_tpavel has quit [Quit: Leaving]
fantasticsid has quit [Remote host closed the connection]
ruurd has joined #ruby
icarus has quit [Read error: Connection reset by peer]
devoldmx has joined #ruby
j5s7 has joined #ruby
finisherr has joined #ruby
<tubbo>
gonna welcome myself to about 15 mins ago and say maintenence is only as necessary as the usage
<[spoiler]>
We should have a readability/niceness score for ruby code, and I don't mean using *flog*
<tubbo>
[spoiler]: what do you propose?
<tubbo>
how else can you statically analyze ruby code?
bronson has joined #ruby
j5s7 has quit [Client Quit]
northfurr has quit [Quit: northfurr]
<shevy>
[spoiler] we need to apply some metric for that
<shevy>
ruboto complains a lot about my code
marr has joined #ruby
michaeldeol has joined #ruby
<[spoiler]>
tools like flog aren't aware of the problem domain your code, and sometimes a few if-s are better than some obscure logic which won't trigger flog
<[spoiler]>
flog... I forgot what I was gonna say
rbennacer has quit [Remote host closed the connection]
devoldmx has quit [Ping timeout: 250 seconds]
mephistophocles has quit [Ping timeout: 256 seconds]
choppington has joined #ruby
markserver has joined #ruby
mephistophocles has joined #ruby
rakm has joined #ruby
dr3w has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
dr3w has quit [Client Quit]
dr3w has joined #ruby
accacin has joined #ruby
<slash_nick>
[spoiler]: i think that'd be tough...there's plenty of room for variation in good looking ruby, as long as a given library is consistent (and nice), it's nice.
<[spoiler]>
tubbo: I don't have a solution, short of "humans should decide," but even then, there's things I consider complex that you don't and vice-versa
bruno- has quit [Ping timeout: 240 seconds]
eam has joined #ruby
banister has joined #ruby
<[spoiler]>
slash_nick: I know, I was joking when I suggested it
<[spoiler]>
:P
<slash_nick>
[spoiler]: you'd want to classify the different styles and measure adherance to each... consistently defines methods with/without parentheses? check
ariwibowo has quit []
rodfersou has quit [Quit: leaving]
beef-wellington has quit [Ping timeout: 240 seconds]
<shevy>
well you could try to list or unifiy on the "most common idioms"
<shevy>
*unify
<shevy>
I always use: def foo(bar) style, many others use: def foo bar
robh71 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<slash_nick>
shevy: i'd just look for consistency within a given library
thmzlt has left #ruby [#ruby]
ramfjord has joined #ruby
<slash_nick>
try to point out anomalies
<tubbo>
[spoiler]: i like rubocop because it can be configured and appended to. so if you need to add style checks to the linter, or customize/remove checks that the linter sends, you can configure that in .rubocop.yml
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<tubbo>
it also has an --auto-gen-config tool that can automatically generate a "todo list" for your app. i find a few of these, like Style/StringLiterals, i keep disabled...others i simply exclude for different dirs (like Style/Documentation in spec/**/*...who needs docs in your tests? :))
<[spoiler]>
tubbo: I am not opposed to rubocop and I don't mind projects that use it, but I think it's a somewhat useless tool, to be honest
jeadr has quit [Remote host closed the connection]
<markserver>
Hello, i'm realising a CLI app in ruby, for one operation i need to verify if an account id exist, i need to execute a mysql query for this, but i have to store the method in the account object and use already created object for logged in user or create a new object and use a validation query in the constructor? Thanks for opinion
accacin has quit [Ping timeout: 260 seconds]
nuttermb has quit [Ping timeout: 246 seconds]
sanguisdex has quit [Read error: Connection reset by peer]
<tubbo>
it's really hard to automate eyeballs :)
<slash_nick>
tubbo: i'd like a rubocop that looked at my library and made decisions on how to config rubocop for me... ie: "you tend to use double quotes, let's make the 'double quotes unless special chars' be cop your quote style cop"... that's the kind of tool i think [spoiler] is talking about
hanmac has joined #ruby
f0ster has joined #ruby
<shevy>
a meta rubocop!
<[spoiler]>
slash_nick: yes a consistency checker would be nice
jeadr has joined #ruby
<tubbo>
slash_nick: agreed, that would be fun. i think you could build it into the existing --auto-gen-config feature that made smarter decisions about the code analysis, rather than simply applying the base ruby style guide across the entire codebase
<slash_nick>
[spoiler]: with rubocop, you have a consistency checker... just not a dynamic consistency checker -- it has to know your preference (doesn't infer it)
sanguisdex has joined #ruby
<jhass>
markserver: some code might make your question clearer
<slash_nick>
tubbo: yeah yeah!
last_staff has joined #ruby
gambl0re has quit [Ping timeout: 260 seconds]
<tubbo>
not sure about you guys, but all of our app/plugin templates at my job contain configuration for lint checking that maps to everyone's style preferences
<tubbo>
it's just automatic so i barely even think about configuring rubocop anymore
<[spoiler]>
?guys tubbo
<ruboto>
tubbo, Though inclusion was probably intended, not everyone relates to being "one of the guys". Maybe consider using "folks", "all", "y'all", or "everyone" instead?
livathinos has joined #ruby
<tubbo>
s/guys/fellow humanoids
Exuma has joined #ruby
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
whiteline has quit [Remote host closed the connection]
techsethi has joined #ruby
<tubbo>
or y'all :)
<[spoiler]>
:D Thanks!
AlexRussia_ has joined #ruby
<shevy>
well [spoiler] actually has made another good point
benlieb has joined #ruby
<shevy>
because I always was so lazy to adjust ruboto ... I want it to auto-adjust! so that would be the library-checking part
<jhass>
shevy: it's rubocop
<[spoiler]>
jhass: it was probably a typo :P
<jhass>
twice?
<[spoiler]>
jhass: I have a better streak than 2
<[spoiler]>
:P
<slash_nick>
tubbo: that's a tough one for me... i've always caught myself s/yall/you guys/ because "don't announce to the world you're from south alabama"... but i'd rather reveal something like that than offend a fellow rubyist
christiandsg has quit [Remote host closed the connection]
Hounddog has quit [Read error: Connection reset by peer]
towski_ has joined #ruby
<[spoiler]>
slash_nick: I am from Croatia and I y'all the f... out of everyone
<shevy>
jhass yeah now I am mixing the rub* up
rideh has joined #ruby
j4cknewt has quit [Remote host closed the connection]
arooni-mobile has joined #ruby
arooni-mobile has quit [Read error: Connection reset by peer]
<shevy>
ruboto is constantly in our face, hard to avoid it
arooni-mobile has joined #ruby
AlexRussia has quit [Ping timeout: 265 seconds]
robh71 has joined #ruby
Exuma has quit [Client Quit]
RobertBirnie has joined #ruby
<[spoiler]>
Mr. Ruboto
ruurd has quit [Quit: ZZZzzz…]
rehat has joined #ruby
jbw has quit [Ping timeout: 246 seconds]
jtdoncas has quit [Ping timeout: 260 seconds]
[Butch] has joined #ruby
jbw has joined #ruby
<[spoiler]>
|_o_
<[spoiler]>
| |
<[spoiler]>
/ \
<[spoiler]>
damn that took long to type (due to typos)
<jhass>
markserver: you're asking a question about code organization and show a single method...
tkuchiki has quit [Remote host closed the connection]
ndrei has joined #ruby
<shevy>
dfockler was your figure tortured there :P
mikecmpbll has quit [Ping timeout: 252 seconds]
<[spoiler]>
shevy: LOL I didn't want to ask because I have no idea why his figure had two forearms and a detached leg
sarkyniin has joined #ruby
bricker has joined #ruby
<shevy>
lol
<jhass>
markserver: I'd go for name_by_account_id for the method name, we generally leave of get_, set_ and is_ prefixes in Ruby
<gregf_>
markserver: should you not throw an exception if the user is not found?
ferhaty has joined #ruby
renderful has quit [Ping timeout: 240 seconds]
ferhaty has quit [Client Quit]
markserver has quit [Ping timeout: 246 seconds]
renderful has joined #ruby
ivanskie has joined #ruby
pawnbox has quit [Remote host closed the connection]
kwerle has joined #ruby
lkba has quit [Remote host closed the connection]
pengin has joined #ruby
jpfuentes2 has joined #ruby
yqt has joined #ruby
<[spoiler]>
gregf_: No, lie and invent an user
<[spoiler]>
gregf_: it's what linked.in does, innit?
<kwerle>
I’m looking for a clever way to segregate an array. set1, set2 = parent_set.segregate{ |e| e.belongs_in_set1? } that would yield set1 with the appropriate elements and set2 with all the elements that were not appropraite. Does such a thing exist and I don’t konw about it?
KensoDev has joined #ruby
<dfockler>
shevy: that's supposed to be his midsection, didn't work out very well
skydiver has joined #ruby
tenderlove has joined #ruby
solars has joined #ruby
kies has quit [Ping timeout: 255 seconds]
<[spoiler]>
kwerle: I don't think there's something that does that (could be wrong)
The_Phoenix has quit [Read error: Connection reset by peer]
colli5ion has quit []
<jhass>
kwerle: #partition ?
JakFrist has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rakm has joined #ruby
<kwerle>
Partition! That’s it.
<kwerle>
Figured someone had done it before me. Thanks!
ruurd has joined #ruby
mikecmpbll has joined #ruby
Chau has quit [Quit: Leaving]
oleksandriuzikov has joined #ruby
chthon has quit [Ping timeout: 244 seconds]
hs366 has quit [Ping timeout: 244 seconds]
whiteline has joined #ruby
c0m0 has quit [Ping timeout: 272 seconds]
pawnbox has joined #ruby
skydiver has quit [Ping timeout: 250 seconds]
lwu has joined #ruby
blue_deref has joined #ruby
<[spoiler]>
jhass: partition is nice! I didn't know about it
mhib has quit [Quit: Leaving]
<adaedra>
There's also his little brother, rpartition
<gregf_>
markserver: nope, but assuming you're displaying a message to the user
elepedus has joined #ruby
<jhass>
markserver: if you want to keep it manual, make the DB connection global (for example by assigning it to a constant) and pass the user instance an account belongs to to its initializer and store it in Account
<jhass>
so you can for example do @user.name to get the name
saddad has joined #ruby
chouhoulis has quit [Remote host closed the connection]
jgpawletko has joined #ruby
conor_ has joined #ruby
einarj has quit [Ping timeout: 244 seconds]
lampd1 has quit [Remote host closed the connection]
symm- has quit [Quit: Leaving...]
mistermocha has quit [Ping timeout: 256 seconds]
Dopagod has quit [Remote host closed the connection]
GnuYawk has quit [Remote host closed the connection]
conor_ has quit [Remote host closed the connection]
einarj has joined #ruby
msnyon has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<shevy>
hmm anyone remembers the name of the ruby windowmanager?
stamina has quit [Quit: WeeChat 1.2]
wookiehangover has quit [Ping timeout: 244 seconds]
bruno- has joined #ruby
conor_ has joined #ruby
DoubleMalt has quit [Remote host closed the connection]
Apocalypse has quit [Ping timeout: 250 seconds]
robh71 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
obiwandev has quit [Read error: Connection reset by peer]
robh71 has joined #ruby
rubie has quit [Remote host closed the connection]
ishahnaz has joined #ruby
yfeldblum has joined #ruby
einarj has quit [Ping timeout: 252 seconds]
einarj_ has joined #ruby
obiwandev has joined #ruby
lucianopc has left #ruby [#ruby]
BTRE has joined #ruby
postmodern has joined #ruby
j3r0 has quit [Ping timeout: 240 seconds]
anon_ has joined #ruby
<shevy>
the source code to webrick-daemon is interesting. exit!(0) optionally, then Process::setsid, then exit!(0) again optionally, a chdir to root via Dir::chdir("/"), then a File::umask, and three .reopen() to STDIN, STDOUT, STDERR
paulcsmith has joined #ruby
toretore has joined #ruby
riotjones has quit [Ping timeout: 250 seconds]
baweaver has joined #ruby
<anon_>
im getting an "ERROR: Failed to build gem native extension" after running "gem install ruby-debug"
<jhass>
anon_: use byebug for Ruby 2.0+
<anon_>
im using ruby 1.9.2
<jhass>
that's EOL
Gabrr has joined #ruby
dr3w has quit [Ping timeout: 256 seconds]
<anon_>
can't do anything baou tit
<anon_>
about it*
Norelec has left #ruby ["Leaving"]
<jhass>
why not?
<Gabrr>
Hi, i would like to use bundle with ruby 2.1, but it doesnt seem to be working.
<Gabrr>
With bundle env, it sais: Ruby 2.0.0p645
<anon_>
code is written in 1.9.2
<jhass>
anon_: The differences with 2.2 aren't that big, worth porting
baweaver has quit [Remote host closed the connection]
<Gabrr>
Im using gentoo, and i installed ruby 2.1, also, set environment variables to use ruby 2.1, but i dont know whats the problem.
<shevy>
anon_ you have to try and find out what particular part failed
chinmay_dd has joined #ruby
baweaver has joined #ruby
<Gabrr>
When i just create an empty Gemfile, it also sais "Ruby: 2.0.0..." with bundle env.
yqt has quit [Ping timeout: 260 seconds]
<anon_>
jhass: my linux system is setup with local repos and 1.9.2 is all i am allowed to install
<jhass>
Gabrr: I guess your bundle's hashbang points to that
<jhass>
command -v bundle
IceyEC has quit [Quit: iceyec]
<anon_>
Can't handle 1.9.x yet
<anon_>
*** extconf.rb failed ***
<jhass>
anon_: that's rather insane
pdoherty has quit [Quit: Leaving]
IceyEC has joined #ruby
<anon_>
i just want to step through some ruby code in eclipse
<shevy>
anon_ I looked into the gem ruby-debug
<anon_>
this can't be that hard.
yfeldblum has quit [Ping timeout: 246 seconds]
<shevy>
I don't see any extension, no extconf.rb and also no possibility for a "failed to build gem native extension". are you sure that the error you got there has anything to do with the gem ruby-debug?
sshuff is now known as sshuff|gone
pawnbox has quit [Remote host closed the connection]
<jhass>
anon_: now add require "pry"; binding.pry in your code where you want to break and run it
<BraddPitt>
oh, thanks jhass
<jhass>
anon_: that should drop you into a repl, run help for the available commands
doodleha_ has joined #ruby
doodleha_ has quit [Remote host closed the connection]
<mwlang>
adding the default in the arguments list makes that argument optional…which is generally desirable (but not always)
<devdazed>
shevy: Antiarc: I was able to accomplish what i needed using ruby's new prepend
spider-mario has joined #ruby
dgutierrez1287 has quit [Ping timeout: 265 seconds]
devoldmx has joined #ruby
oddjob001 has joined #ruby
Xoro has joined #ruby
djbkd has quit [Remote host closed the connection]
Xoro has quit [Max SendQ exceeded]
Xoro has joined #ruby
baweaver has quit [Remote host closed the connection]
<shevy>
\o/
<shevy>
it sounds scary so I better don't ask how it works :D
devoldmx has quit [Ping timeout: 244 seconds]
deol has joined #ruby
Porfa has quit [Ping timeout: 244 seconds]
<oddjob001>
can someone help me understand how to regex or match a line from each_line? It seems to do nothing. I can do a simple line.chomp! and it will remove the /n, but attempting to remove (or capture) any other information doesnt work. - https://gist.github.com/tek0011/f00e4f7de76de70a1857
<devdazed>
shevy: instead of aliasing the method, I override it and prepend the mixin so it comes first in the ancestor chain
<BraddPitt>
does the ruby postgres gem accept a certain type of schema file for building the db?
Torrieri has quit [Quit: Be back later ...]
<jhass>
oddjob001: what's your actual goal?
djbkd has joined #ruby
northfurr has quit [Quit: northfurr]
Gabrr has quit [Ping timeout: 246 seconds]
michaeldeol has quit [Ping timeout: 246 seconds]
<drbrain>
BraddPitt: how do you mean?
<markserver>
Hello, can anyone help me with this error..Thanks : C:/Ruby22-x64/lib/ruby/2.2.0/erb.rb:863:in `eval': (erb):1: unterminated string meets end of file (SyntaxError) (erb):1: syntax error, unexpected end-of-input, expecting ')' ...ut.force_encoding(__ENCODING__)
<jhass>
oddjob001: remove all elements that have a space?
<oddjob001>
jhass: to basically get 10:00:00:90:fa:73:36:3a (the wwn) from each line. I will be passing that back into another command
conor_ has joined #ruby
<drbrain>
BraddPitt: it sends SQL commands to a postgres server, so the schema must be a format postgres understands
<BraddPitt>
right, im trying to find out what that format is
zz_Outlastsheep has quit [Remote host closed the connection]
<BraddPitt>
like, can I send it as a YAML file or should it just be SQL statements in a text file?
<drbrain>
AFAIK psql doesn't translate YAML to SQL
<oddjob001>
jhass: giving it a try
<jhass>
markserver: look for a missing " or '
conor_ has quit [Remote host closed the connection]
<jhass>
or one that isn't escaped properly
livathinos has joined #ruby
<BraddPitt>
drbrain should it just be raw SQL commands in a text file and load that?
<oddjob001>
jhass: that actually only captures the last two characters after the final : on each line
<jhass>
oddjob001: derp, right, missed a , 2)
<oddjob001>
jhass: added space.. woops
djbkd has quit [Remote host closed the connection]
<oddjob001>
what about
<jhass>
.split(":", 2)
<oddjob001>
split(": "
<oddjob001>
)
<oddjob001>
yours is even better. still learning :P
<jhass>
I guess String#partition would work too, but I somehow like split better
whiteline has joined #ruby
<oddjob001>
i couldnt get parititon to work for the life of me
<oddjob001>
only outside of the each_line/each_with_index
<drbrain>
BraddPitt: I think something like the #execute method lets you do that, yes
conor_ has joined #ruby
jds has quit [Quit: Connection closed for inactivity]
<drbrain>
BraddPitt: it's not much different than using `psql`
<BraddPitt>
ok, ill do that then
<BraddPitt>
right
chouhoulis has joined #ruby
chouhoulis has quit [Remote host closed the connection]
conor_ has quit [Remote host closed the connection]
chouhoulis has joined #ruby
pragmatism has quit [Ping timeout: 240 seconds]
conor_ has joined #ruby
elepedus has quit [Ping timeout: 250 seconds]
<oddjob001>
thanks jhass that worked. now I will stay in this channel because im sure Ill have questions again soon :P
finisherr has quit [Quit: finisherr]
jeadr has quit [Remote host closed the connection]
conor_ has quit [Remote host closed the connection]
elepedus has joined #ruby
JoshL has quit []
pawnbox has joined #ruby
jeadr has joined #ruby
dr3w has quit [Ping timeout: 250 seconds]
mleung has quit [Quit: mleung]
oivoodoo has joined #ruby
Embly has joined #ruby
conor_ has joined #ruby
Embly has left #ruby [#ruby]
ramfjord has joined #ruby
dumdedum has quit [Ping timeout: 240 seconds]
conor_ has quit [Remote host closed the connection]
livathinos has quit []
elepedus has quit [Ping timeout: 260 seconds]
renderfu_ has joined #ruby
conor_ has joined #ruby
tomphp_ has joined #ruby
baweaver has joined #ruby
northfurr has joined #ruby
renderful has quit [Ping timeout: 272 seconds]
ponga has quit [Quit: Connection closed for inactivity]
tomphp has quit [Ping timeout: 260 seconds]
tomphp_ has quit [Max SendQ exceeded]
<hfp>
Hey all, I'm having a bit of an issue with testing... This is what I have: https://gist.github.com/Coaxial/1029fd2549e187ec662f. But the test fails, because it says subject never receives the :answer message. I am using a ruby framework called Adhearsion for this code but I'm hoping this is irrelevant and can be figured with plain ruby. Is there anything that looks odd in the gist?
Musashi007 has joined #ruby
blackmesa has quit [Ping timeout: 255 seconds]
<Mon_Ouie>
hfp: You're never calling #run as far as I can tell.
DLSteve has joined #ruby
RegulationD has joined #ruby
<hfp>
Mon_Ouie: In a normal setting, the framework calls it when it runs every controller. Was I wrong to assume it would do it too within a test?
Papierkorb has joined #ruby
<Antiarc>
You'd be well-served to check out of adhearsion has any particular testing facilities; it's likely that you aren't actually invoking whatever calls your controllers' #run methods
bruno- has joined #ruby
JakFrist has joined #ruby
<Papierkorb>
Hi, i'm currently looking at rubocop. Why does rubocop by default tell you to use fail instead of raise?
ruurd has quit [Quit: Bye]
<Antiarc>
Because it's the opinion that the Rubocop maintainers configured. You can change it if your codebase opines otherwise :)
<Mon_Ouie>
Your testing framework (whichever that is) can't know to call #run if you don't tell it to somehow
skydiver has joined #ruby
northfurr has quit [Quit: northfurr]
<hfp>
Mon_Ouie, Antiarc: That makes sense, thanks
<Papierkorb>
Antiarc: just looks weird. for one, I didn't knew about fail, and then, no tutorial/howto code I've seen ever used fail
gamename has joined #ruby
northfurr has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
<Papierkorb>
Antiarc: but thanks, thought it had some other reason
<Antiarc>
Papierkorb: yeah, I learned to use "raise", too. Personally I just reconfigure rubocop to look for "raise" rather than "fail"
<Antiarc>
IIRC fail and raise are aliases
<Antiarc>
The only difference would be semantic
pragmatism has joined #ruby
<Antiarc>
"because I use exceptions to indicate failures, I almost always use the “fail” keyword rather than the “raise” keyword in Ruby. Fail and raise are synonyms so there is no difference except that “fail” more clearly communcates that the method has failed. The only time I use “raise” is when I am catching an exception and re-raising it, because here I’m *not* failing, but explicitly and purposefully raising an exception. This is
<Antiarc>
a stylistic issue I follow, but I doubt many other people do"
<Antiarc>
From Jim Weirich
<Antiarc>
So that's probably about as clear a reason as any
baroquebobcat has joined #ruby
christiandsg has joined #ruby
choke has joined #ruby
thermatix has joined #ruby
northfurr has quit [Client Quit]
baroquebobcat has quit [Client Quit]
baroquebobcat has joined #ruby
<Antiarc>
"the idea is that by combining fail and raise you're quickly able to discern whether you have an exceptional condition or are simply re-raising an exception"
<pipework>
That's an interesting though. I've used fail before, but didn't really consider using it like that.
<Antiarc>
But it's just semantics in the end. Use whichever makes your code and intent the most clear.
<shevy>
well he is right in the stylistic part, fail() sounds different to raise()
eytanfb has quit [Quit: Connection closed for inactivity]
<shevy>
fail makes me much more nervous too, I start to bite on my finger nails
skydiver has quit [Ping timeout: 250 seconds]
suchness has quit [Ping timeout: 250 seconds]
pawnbox has quit [Remote host closed the connection]
nuttermb has joined #ruby
yfeldblum has joined #ruby
Gabbr_ has joined #ruby
northfurr has joined #ruby
<Gabbr_>
I still cant use rubygems with ruby21.
<Gabbr_>
How to setup rubygems so that it uses ruby21?
j3r0 has joined #ruby
benlieb has quit [Quit: benlieb]
christiandsg has quit [Ping timeout: 265 seconds]
<pipework>
Gabbr_: how are you installing ruby?
thermatix has quit [Ping timeout: 265 seconds]
djbkd has joined #ruby
DexterLB has quit [Read error: Connection reset by peer]
benlieb has joined #ruby
kristofferR has joined #ruby
jackjackdripper has joined #ruby
existensil has quit [Ping timeout: 250 seconds]
n008f4g_ has joined #ruby
einarj_ has quit [Remote host closed the connection]
platzhirsch has left #ruby [#ruby]
stef1a has joined #ruby
<Gabbr_>
pipework: gentoo, with RUBY_VERSION ruby21, and eselect ruby ruby21
<pipework>
Gabbr_: is this a production machine?
<Gabbr_>
installation with package manager: emerge ruby
<miah>
what is your error?
<Gabbr_>
pipework: Its my own computer.
eminencehc has quit [Remote host closed the connection]
<miah>
?xy
<ruboto>
it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
<pipework>
My guess is that it's an issue with the package manager's way of installing ruby.
benlieb has quit [Client Quit]
Adran has quit [Quit: Este é o fim.]
baweaver has quit [Remote host closed the connection]
<miah>
how are you trying to use rubygems, what error are you getting?
<pipework>
Gabbr_: I use one system ruby installed by my package manager (the latest stable for that package manager with stable and trustable repos) and then chruby + ruby-install
<Papierkorb>
Again to rubocop, I don't understand the Metrics configuration. So, eg. Metrics/ClassLength: Max: 100 - So, is the maximum 100 lines, or something else?
lannonbr has joined #ruby
<stef1a>
I would like to create the nested directories ./a/b/c, and I don't know whether they exist. How can I create them all, regardless of whether parts of the directory structure already exist? (e.g., if ./a/ exists, I still want to be able to create b/c/ within ./a/)
<oddjob001>
how come the output of new_emodels after the split, doesnt actually seem to split the string
<miah>
pipework: thats not required in gentoo as its rolling release and has a usable default ruby installation
<jhass>
oddjob001: .split doesn't change the receiver
DexterLB has joined #ruby
<pipework>
miah: I'm not sure what you mean. I'm just suggesting to use the system package manager's default way of installing ruby without anything remotely custom.
<jhass>
oddjob001: think about it, split turns a string into an array of strings
<Gabbr_>
miah: just a second.
jackjackdripper has quit [Client Quit]
<miah>
pipework: they are using the systems package manager
<jhass>
oddjob001: how could it turn an instance of String into an instance of Array? It can only return a new one
dstarh has joined #ruby
jackjackdripper has joined #ruby
<pipework>
miah: I'm aware, and I mentioned first that the issue may just be with how they package it and possibly how the user installed it. :)
<Gabbr_>
miah: I dont understand ruby at all, i just need it to run something. I need to run bundle, but it currently sais: bundle env, and the response: /usr/lib64/ruby/2.0.0/rubygems.rb:15:in `require': cannot load such file
<Gabbr_>
Also
<jhass>
oddjob001: that said, .split "\n" -> .lines
bumbar_ has quit [Ping timeout: 260 seconds]
<oddjob001>
jhass: i do not know. I am ~ 6 hours in to ruby, my first language. Well BASIC was my first, but my first since then :P
conor_ has quit [Remote host closed the connection]
<miah>
what file are you trying to run in ruby that is giving you this require error?
markserver has quit [Ping timeout: 246 seconds]
<Ox0dea>
stef1a: FileUtils.mkdir_p is the method you're after.
<pipework>
`bundle env` I think
<miah>
once ruby is installed, you'll need to 'gem install bundler'
<miah>
pipework: ah ya i misread
<pipework>
miah: Nah, it was kinda hard for me to find too.
<dostoyevsky>
is it common that some gems can't be required by their gem name? ruby-odbc is such a case... require 'ruby-odbc' will not work
<miah>
i saw this error before
Adran has joined #ruby
<jhass>
dostoyevsky: sadly yes, it's violating conventions though
<stef1a>
Ox0dea: is that equivalent to `mkdir -p 'a/b/c'` run on the command line?
<Gabbr_>
Yes, still, after gem install bundler, the same error message
<dostoyevsky>
jhass: yeah, that was the ruby19 gentoo problem i had earlier... turns out I just didn't do require 'odbc' to use the ruby-odbc gem :)
<oddjob001>
hmmm still dont get it
<jhass>
duh
solars has quit [Ping timeout: 240 seconds]
<jhass>
oddjob001: .split (and .lines which you should use for this case too) returns a new object, you need to assign (a = b) it to something
<Gabbr_>
miah: Still, the same error message.
<Gabbr_>
I asked this on gentoo irc too, noone said anything.
<oddjob001>
jhass: ah ok. let me play. thanks.
<miah>
Gabbr_: what does `bundle --version` show?
northfurr has quit [Quit: northfurr]
pengin has quit [Remote host closed the connection]
<Gabbr_>
miah: The same error message. Wait, i try something.
<Ox0dea>
Are there any languages wherein in-place mutation can cross class boundaries?
benlieb has joined #ruby
<jhass>
PHP?
<Ox0dea>
It'd be interesting if `foo.split!` turned `foo` into an Array, but also pretty terrible.
<Gabbr_>
Now i dont have ruby20, but when i install it (as im doing it right now), bundler works, just with
<Gabbr_>
ruby20.
<shevy>
ruby2000!
<jhass>
Gabbr_: edit the hashbang to use /usr/bin/env ruby ?
<apeiros>
Ox0dea: that'd require weak typing
ramfjord has quit [Ping timeout: 246 seconds]
<Gabbr_>
jhass: With bundler, isnt it too intrusive? I could do that, but im afraid it will break something.
<Ox0dea>
apeiros: Let's do it!
speakingcode has quit [Ping timeout: 256 seconds]
<apeiros>
uh, no thanks. not a fan of that idea :)
<Gabbr_>
It should be some option or selection from something, not editing files?
whiteline has quit [Remote host closed the connection]
victortyau has quit [Quit: Leaving]
<jhass>
Gabbr_: idk what you're using and what Gentoo's doing, so I can't say how intrusive it would be
<Papierkorb>
Ox0dea: Java btw. In fact, isn't that quite a common thing with many languages?
<Ox0dea>
Papierkorb: No, not at all.
<Ox0dea>
>> {}.replace [] rescue $!
<ruboto>
Ox0dea # => #<TypeError: no implicit conversion of Array into Hash> (https://eval.in/417877)
<Ox0dea>
Is there nowhere I can define that implicit conversion?
existensil has joined #ruby
<apeiros>
Ox0dea: don't know for hash, but for "to array" it's defining to_ary
tmtwd has joined #ruby
<Gabbr_>
usr/local/bin/bundler has this first line: #!/usr/bin/ruby20
<apeiros>
(and for "to integer" it's to_int)
<Papierkorb>
Ox0dea: void foo(ArrayList<String> foo){ foo.add("123"); } - 'final' won't save you. The only languages I know which do have proper support for that are C and C++
<Ox0dea>
apeiros: I know about the coercion methods; this is a little different, I think.
<jhass>
Gabbr_: the Ruby version managers maintain their own bin/'s and patch $PATH accordingly on version switch, most distributions shipping multiple ruby versions also version binstubs for them, ruby21 -> bundle21 and such
<Gabbr_>
But i dont want to edit this, it sais: # This file was generated by RubyGems.
<apeiros>
Ox0dea: no, that's precisely that
<jhass>
for package installed gems that is of course
<apeiros>
Ox0dea: it tries to convert your [] to a hash which could be used in Hash#replace
northfurr has joined #ruby
<Ox0dea>
Huh, so it does.
<Ox0dea>
#to_hash, by the way.
<Gabbr_>
jhass: In theory, gentoo uses ruby_version_ruby21 USE flag for that, so i could use ruby21 with rubygems and bundle and such... But in practice something went wrong.
<oddjob001>
jhass: thanks again. got it to work and lurned gud
<jhass>
Gabbr_: my guess is your /usr/local/bin/bundler was installed by sudo gem install while it used ruby20
yqt has joined #ruby
northfurr has quit [Client Quit]
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mephistophocles has joined #ruby
dr3w has joined #ruby
platzhirsch has joined #ruby
platzhirsch has left #ruby [#ruby]
<Gabbr_>
Now, as ive installed ruby20, bundle --version sais 1.10.6
sshuff|gone is now known as sshuff
<unver>
How do I get epoch Ruby Time? I need a date that will always sort last
bb010g has joined #ruby
deol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<stef1a>
is there a way to rescue from errors that occur while executing a terminal command from a ruby script?
michaeldeol has joined #ruby
rbennacer has quit [Remote host closed the connection]
ascarter has joined #ruby
michaeldeol has quit [Client Quit]
j3r0 has quit [Quit: Leaving]
ramfjord has joined #ruby
ruurd has joined #ruby
jackjackdripper has quit [Quit: Leaving.]
j4cknewt has quit [Remote host closed the connection]
<kaikazou>
>> puts "jhass needs a computer with a ruby interpreter, or to query ruboto ;o"
<ruboto>
kaikazou # => jhass needs a computer with a ruby interpreter, or to query ruboto ;o ...check link for more (https://eval.in/417881)
<jhass>
Gabbr_: since you're not elaborating on what you need all this for, maybe just sudo gem install bundler again with ruby21 active and overwrite the binstub
<jhass>
Gabbr_: I think I'd still recommend a env hashbang though
michaeldeol has joined #ruby
benlieb has quit [Quit: benlieb]
JoshL has joined #ruby
<jhass>
kaikazou: nope, that was meant as demos :P
rbennacer has joined #ruby
havenwood has joined #ruby
<kaikazou>
jhass, can't I have this moment? :(
radgeRayden has joined #ruby
<jhass>
kaikazou: I just demonstrated that epoch isn't the oldest date Ruby can represent
<Gabbr_>
jhass: I need this for openproject.
whiteline has joined #ruby
<jhass>
Gabbr_: I mean rather if you need ruby20 still etc.
reset has joined #ruby
<mwlang>
why the heck would anyone do this?? “@item = item ||=@item”
<jhass>
because it's syntactically valid?
<pipework>
mwlang: So item isn't ever falsy?
<pipework>
Err @item
<pipework>
Or rather, it can only be set falsy initially and never again
nuttermb has quit [Ping timeout: 265 seconds]
<jhass>
I think it's keep the old value of @item if item isn't present
CorySimmons has joined #ruby
<jhass>
@item = item if item
benlieb has joined #ruby
<mwlang>
why not @item ||= item
paulcsmith has quit [Quit: Be back later ...]
kadoppe has quit [Ping timeout: 240 seconds]
<mwlang>
same thing, right?
<Mon_Ouie>
Nope, that wouldn't set item to something
<pipework>
jhass: Isn't that what I said?
jackjackdripper has joined #ruby
<jhass>
no, that's conditional on @item's falsiness, not item's
<pipework>
Maybe it wasn't the easiest english to understand.
j4cknewt has joined #ruby
<unver>
does it string together @item=item=@item ?
<mwlang>
oh, wait…so they’re setting “item” to something non-falsy rather than @item.
<mwlang>
the odd thing is they only reference @item below that line.
jackjackdripper has quit [Client Quit]
<jhass>
what's item, where does it come from?
jackjackdripper has joined #ruby
<jhass>
I still think @item = item if item is the intention
<jhass>
pipework: mmh, I guess
<Mon_Ouie>
It's the same as 'item ||= @item; @item = item'
benlieb has quit [Client Quit]
kadoppe has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
<Papierkorb>
Wow. After tuning rubocop it's actually really useful. from 70 offenses down to now 4, then to 0 in two minutes. I think that was quite worth it
speakingcode has quit [Ping timeout: 244 seconds]
<Ox0dea>
stef1a: If the command didn't exist, you'll get an Errno::ENOENT exception, which can of course be rescued.
jackjackdripper has quit [Client Quit]
<Ox0dea>
Otherwise, you'll probably want to use Kernel.system and check its return value.
jackjackdripper has joined #ruby
baroquebobcat has joined #ruby
Rutix has quit []
melter has quit [Remote host closed the connection]
ivanskie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
shoutsid has quit [Remote host closed the connection]
speaking1ode has joined #ruby
sideshowcoder has quit [Quit: Connection closed for inactivity]
shoutsid has joined #ruby
nanoz has quit [Quit: <3]
dr3w has quit [Ping timeout: 272 seconds]
howdoico1 has quit [Ping timeout: 245 seconds]
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dmolina has quit [Quit: Leaving.]
eminencehc has joined #ruby
pengin has quit [Remote host closed the connection]
<mwlang>
sorry, had to step away for a bit…”item” is a local variable to the partial.
speakingcode has quit [Ping timeout: 265 seconds]
robh71 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mwlang>
so it doubly makes little sense to do @item = item ||= @item
<mwlang>
either you have an item or you don’t and that line’s not gonna make one bit of difference to the partial’s point of view.
jeremy04 has quit [Read error: Connection reset by peer]
jeremy04 has joined #ruby
<hal_9000>
item = 5 unless item == 5 # ;)
speakingcode has joined #ruby
bweston has joined #ruby
Gabbr_ has joined #ruby
<mwlang>
hal_9000: that’s pretty much the gist of it, IMO
ivanskie has joined #ruby
paulcsmith has joined #ruby
tmtwd has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
solars has joined #ruby
jackjackdripper has quit [Quit: Leaving.]
sreggin has joined #ruby
jackjackdripper has joined #ruby
psy_ has quit [Ping timeout: 250 seconds]
<Gabbr_>
I have two different bundles.
<Gabbr_>
One is in /usr/local/bin
<sreggin>
does anyone know a good private tracker for elearning torrents?
<Gabbr_>
and on is in /usr/bin
<jhass>
?ot sreggin
<ruboto>
sreggin, this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
Musashi007 has quit [Quit: Musashi007]
<Gabbr_>
And the one in /usr/bin uses ruby21, the other ruby20...
<Gabbr_>
Where does the gem install store its files?
<jhass>
Gabbr_: so get rid of the latter?
gambl0re has joined #ruby
ivanskie has quit [Client Quit]
<Gabbr_>
jhass: I will, but i want to know where does the other come from so i can clean the system from the wrong files.
mistermocha has joined #ruby
<jhass>
Gabbr_: as said, prolly sudo gem install bundler while ruby20 was active
<Gabbr_>
jhass: Probably.
<jhass>
gem env shows where it'll install stuff
kristofferR has joined #ruby
<Gabbr_>
jhass: Thanks.
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
obiwandev has joined #ruby
choke has joined #ruby
<Gabbr_>
jhass: Interestingly, none of the directories is the /usr/local/bin, only the SHELL PATH.
banister has joined #ruby
<jhass>
I guess that was different with ruby20 active (and possibly another rubygems version back then)
<Gabbr_>
Maybe.
robh71 has joined #ruby
JakFrist has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ivanskie has joined #ruby
<Gabbr_>
Yes, well, i will do some test installs to find it out.
rbennacer has quit [Remote host closed the connection]
jackjackdripper has quit [Quit: Leaving.]
rbennacer has joined #ruby
jackjackdripper has joined #ruby
juanpaucar has joined #ruby
juanpaucar has quit [Read error: Connection reset by peer]
juanpaucar has joined #ruby
mistermocha has quit [Ping timeout: 250 seconds]
<jhass>
!ban sreggin !T 1w offensive nick
sreggin was banned on #ruby by ChanServ [sreggin!*@*]
sreggin was kicked from #ruby by ChanServ [Banned: offensive nick]
AxonetBE has quit [Quit: AxonetBE]
<Gabbr_>
That was a bit harsh in my opinion.
<jhass>
Gabbr_: there was a warning over in #ruby-offtopic
<Mon_Ouie>
That's also ban evasion anyway
einarj has joined #ruby
blue_deref has quit [Quit: bbn]
JakFrist has joined #ruby
<Gabbr_>
I still dont understand. I know its not a ruby problem now, so its unnecessary for me to say this, but
<jhass>
you mean why? read it backwards
<Gabbr_>
the /usr/local/bin/bundle created half an hour ago, and dont know what created it.
baweaver has joined #ruby
<Gabbr_>
jhass: No, i get that. Im talking about my problem.
<jhass>
ah well, no idea
<akurilin2>
question: is it possible to get something like the $@ variable in ruby scdripts?
<jhass>
I think most of us know that site, but thanks
<Ox0dea>
akurilin2: If you're on Linux, you can use File.read('/proc/self/cmdline').split(?\0).
sdothum has joined #ruby
<Ox0dea>
Otherwise, you're outta luck. :(
baweaver has quit [Ping timeout: 252 seconds]
<akurilin2>
I'm basically trying to pass the params AS IS to a bash script I'm invoking inside
<jhass>
sure they don't just want ARGV?
<jhass>
system("/bin/bash", "script", *ARGV)
<cschneid_>
I have a dozen or so http calls I'd like to do in parallel, is there a low-ceremony way to wrap them up in futures/promises? Ideally I'd fire them all off then call .result on them to collect up the answer. anybody know of a convenient gem?
<Ox0dea>
jhass: ARGV is a myth.
da3mian has quit [Client Quit]
da3mian has joined #ruby
<slash_nick>
cschneid_: concurrent-ruby
rafaelfranca has left #ruby [#ruby]
polpak has joined #ruby
jackjackdripper has quit [Client Quit]
jackjackdripper has joined #ruby
<cschneid_>
slash_nick: fancy. This doesn't need any weird dependencies (event machine or similar)?
<akurilin2>
I'll try those approaches you guys suggested, thank you. Never heard of /proc/self/cmdline, that's awesome
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Gabbr_>
I found out what created those bad bundle files.
<cschneid_>
slash_nick: cool, I'll give this a shot
baweaver has joined #ruby
Deion has joined #ruby
<jhass>
?guys akurilin2
<ruboto>
akurilin2, Though inclusion was probably intended, not everyone relates to being "one of the guys". Maybe consider using "folks", "all", "y'all", or "everyone" instead?
oivoodoo has quit []
<Gabbr_>
Its a bit funny how i could only use the bundle with ruby20, because the old gem created a file in /usr/local/bin, and i couldnt use it, but the newer version of bundle in /usr/bin was there.
<Gabbr_>
So how do i get gem to uninstall all the gems?
jeadr has quit [Remote host closed the connection]
sshuff is now known as sshuff|gone
yqt has quit [Ping timeout: 245 seconds]
<jhass>
Gabbr_: mmh, don't think there's anything to uninstall all. make sure to uninstall anything that might be installed via your package manager and then you could try to script something parsing gem list and feeding it into gem uninstall
haylon has joined #ruby
<dorei>
I want to have a POST route that adds some data into my db. From what I understand so far, when everything goes ok I should respond with either 200 or 201, what should my POST return in case of data insertion failure?
ivanskie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<haylon>
Why would I not be able to use a .split inside of a each_line loop? I keep getting undefined method 'split' for nil:NilClass (NoMethodError)
jackjackdripper has quit [Client Quit]
<jhass>
dorei: depends on the failure a bit, just 500 if unsure
jeadr has joined #ruby
<Coraline>
dorei: or 422 if it's an input problem
<Gabbr_>
jhass: Ok, thats what i will do then.
<jhass>
?code haylon
<ruboto>
haylon, We can't help you without your code, please post it to https://gist.github.com
<dorei>
Coraline: i want to avoid to have duplicate data, i guess duplicate data is an input problem, right?
binaryplease has joined #ruby
<Coraline>
That could be argued as such, yeah
<jhass>
dorei: if the submitter can know it's a duplicate yeah
<jhass>
haylon: result will be nil if the regex doesn't match
<jhass>
maybe you meant to next unless ... ?
<haylon>
If I don't do the .split(/\s+/) it'll print all the matches just fine though
Musashi007 has joined #ruby
kidoz has joined #ruby
<jhass>
and all non-matches too
mrtg9970 has joined #ruby
bronson has quit [Remote host closed the connection]
diegoviola has quit [Quit: WeeChat 1.2]
tmtwd has quit [Ping timeout: 272 seconds]
poguez_ has quit [Quit: Connection closed for inactivity]
benlieb has quit [Client Quit]
<haylon>
jhass: it shouldn't.
<jhass>
you mean you don't want it to
<haylon>
when I change it be puts line if line =~ /Handling Logon/ it just prints what I want. But I want to capture the line I want, then take that line and split the string and print certain parts of that string.
<haylon>
I've done it before, but for whatever reason, its not working now
<jhass>
well, then the puts is inside the conditional of course
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<jhass>
I start to wonder if you even try to understand what's happening or if you keep insisting that your code must work and Ruby is at fault for giving you an error...
binaryplease has quit [Quit: WeeChat 1.2]
binaryplease has joined #ruby
radgeRayden_ has joined #ruby
<haylon>
I'm thinking on it. your examples aren't making sense to me. My apologies.
axsuul has joined #ruby
<jhass>
anyway, put all your code into the conditional or skip non-matches which results into the same
platzhirsch has joined #ruby
<jhass>
can you tell me the difference between: a if condition; b; and if condition; a; b; end; ?
Swappticon has joined #ruby
kallisti5 has quit [Quit: leaving]
rideh has quit [Quit: zap]
<haylon>
I can't think of the word, but is it something like, use a if it matches, otherwise use b for the first one.
<haylon>
The second one has the end to the if. the second is not using it, like python.
<jhass>
no
<jhass>
there's no implicit end's in Ruby
ascarter has quit [Read error: Connection reset by peer]
ascarter has joined #ruby
<jhass>
and it doesn't care about indentation at all
JakFrist has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bruno- has joined #ruby
<jhass>
let's call a and b statements, can you tell me which statements will be executed for which values of condition (true/false) in both examples?
<haylon>
if a is true, then b will be executed, and if true, both a and b will be executed.
speaking1ode has quit [Quit: Reconnecting]
speaking1ode has joined #ruby
<jhass>
try again, we call the examples 1 and 2, a and b are the statements that can be executed and condition is what can be true or false
stef1a has quit [Quit: leaving]
jpfuentes2 has joined #ruby
oddjob001 has quit [Ping timeout: 246 seconds]
radgeRayden_ has quit [Ping timeout: 244 seconds]
<jhass>
"in example 1, if condition is X then a will (not) be executed and b will (not) be executed"
dr3w has quit [Ping timeout: 240 seconds]
skydiver has joined #ruby
<jhass>
make me four such sentences to answer all cases
pengin has joined #ruby
bruno- has quit [Ping timeout: 250 seconds]
ruurd has quit [Quit: ZZZzzz…]
<Ox0dea>
"Drop and give me four."
<haylon>
if condition is x, then a will be executed and b will be executed; if condition ix x then a will not be executed and b will be executed; if condition is x then a will be executed and b will not be executed; if condition is x a will not be executed and b will be executed.
christiandsg has joined #ruby
<Ox0dea>
haylon: You were supposed to replace those Xs, mate.
<haylon>
ah
<haylon>
brb
tmtwd has quit [Ping timeout: 265 seconds]
skydiver has quit [Ping timeout: 250 seconds]
benlieb has joined #ruby
da3mian has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
techsethi has quit [Quit: techsethi]
<haylon>
jhass, I'll have to come to you later, I'm just not comprehending this stuff right now. I need to think on it.
<jhass>
haylon: maybe read up on what modifier-if is
christiandsg has quit [Ping timeout: 265 seconds]
lele|w has quit [Ping timeout: 264 seconds]
nkts has joined #ruby
<haylon>
One last stab at it, otherwise I'm gonna have to take a break for a sec.
da3mian has joined #ruby
kies has joined #ruby
<haylon>
a is executed if the condition on the right is true. Then execute b for example 1. the second example is a normal if condition is true, execute the code inside of the if block.
<jhass>
yes
<jhass>
now do you see what the issue in result = line if line =~ /.../; result.split is ?
<jhass>
result = line is a; result.split is b; but for b to work it depends on a being run
<haylon>
I htink so
<haylon>
regardless of if =~ matches anything, split is going to split nothing if it loops through
stef_204 has quit [Ping timeout: 245 seconds]
<jhass>
yeah
hololeap has quit [Ping timeout: 246 seconds]
momomomomo has joined #ruby
Gabbr_ has quit [Ping timeout: 246 seconds]
<haylon>
Ok, that makes sense.
<haylon>
Would you suggest nesting another if inside of that then?
da3mian has quit [Client Quit]
hololeap has joined #ruby
<jhass>
either don't use the modifier-if, put the conditional around all statements that depend on it being true, or skip the line with next if you don't want to process it
<jhass>
which basically results in the same control flow
<jhass>
run all or none statements depending on the condition
<haylon>
I've never used the `next` statement before
Averna has joined #ruby
<jhass>
it's like return for blocks
<Ox0dea>
Not quite.
<jhass>
how so?
<haylon>
where would I put that in the modifier-if?
<al2o3-cr>
it's like continue in other languages
<Ox0dea>
^
obiwandev has joined #ruby
obiwandev has quit [Remote host closed the connection]
<jhass>
in usage/effect
<jhass>
but it returns from the block
obiwandev has joined #ruby
<Ox0dea>
Aye, I suppose that's a fair enough analogy given that you can supply it with arguments.
<jhass>
haylon: the next variant would be next unless lines =~ /.../ as the first line of the block
<jhass>
*line
Xiti has quit [Ping timeout: 244 seconds]
tmtwd has joined #ruby
rubie has joined #ruby
phutchins1 has quit [Ping timeout: 244 seconds]
<Ox0dea>
>> [1, 2, 3].map { |i| next 'even' if i.even?; 'odd' }
skade has quit [Quit: Computer has gone to sleep.]
icarus has joined #ruby
<pipework>
woobywoob: Probably a good decision. I sometimes make those kinds of decisions where I don't link it with only the things I care about and then something comes up later and I totally forget that I made that decision and I waste a lot of time until I recall or find what my past self decided.
<pipework>
It's always future self's fault.
chipotle has quit [Quit: cheerio]
phutchins1 has joined #ruby
chipotle has joined #ruby
nitenq has quit [Quit: nitenq]
dgutierrez1287 has quit [Ping timeout: 246 seconds]
jeadr has quit [Remote host closed the connection]
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pleiosaur has joined #ruby
vidbina has quit [Quit: leaving]
binaryplease has quit [Ping timeout: 264 seconds]
mrtg9970 has quit [Quit: Leaving]
elfuego has joined #ruby
rehat has quit [Remote host closed the connection]
elfuego has quit [Quit: elfuego]
rahult has joined #ruby
rahult is now known as rahult_
<ght>
How's it going?
rahult_ is now known as rahult
reset has quit [Quit: Leaving...]
<ght>
FYI, if any of the guys who were working with me on manual GC utilization last night, I implemented it on an old Ruby 2.0.x app that normally uses quite a bit of RAM.
<ght>
It has a throttling engine, I set it so that it runs GC.start on throttle implementation, so it only runs after X number of API calls
<ght>
And the RAM usage has shown dramatic improvement.
<ght>
So thank you, that was great advice.
<shevy>
cool
LiquidInsect has joined #ruby
IceyEC has joined #ruby
einarj_ has quit [Remote host closed the connection]
<shevy>
ruby is getting faster and faster
<drbrain>
ght: I'm sure this was discussed, but if you can, upgrading to 2.2 should show further improvements due to generational GC
blackmesa has joined #ruby
veduardo has joined #ruby
Sembei has quit [Ping timeout: 244 seconds]
Swappticon has quit [Quit: My Mac has gone to sleep. ZZZzzz…]