<roychri>
Is there an elegant way of handling exception from different ruby version? I see this open source project rescuing from Net::OpenTimeout which is a ruby 2.x but that project tries to be compatible with 1.9.3 too. I'd like to do a PR with a fix. Any recommendations?
moted has joined #ruby
zenguy_pc has joined #ruby
<Ox0dea>
roychri: You can give `rescue` an arbitrarily complex expression so long as it evaluates to an exception.
<roychri>
sounds interesting.... ok, I will take a look, thank you
<Ox0dea>
roychri: Something like `rescue RUBY_VERSION >= ?2 ? Net::OpenTimeout : SomethingElse` should suffice.
<roychri>
Sounds simple enough, I will try it :) Thank you
<Ox0dea>
Happy to help.
swgillespie has joined #ruby
cjbottaro has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
leat has quit [Remote host closed the connection]
allcentury has quit [Ping timeout: 250 seconds]
leat has joined #ruby
<havenwood>
|>
cjbottaro has joined #ruby
<Ox0dea>
.=
<Ox0dea>
Both would be welcome additions.
EllisTAA has quit [Quit: EllisTAA]
podman has quit [Quit: Connection closed for inactivity]
<havenwood>
Christmas 2016?
<havenwood>
Probably later...
<havenwood>
3.0 after 2.3 or after 2.4? I wonder.
diegoviola has joined #ruby
<havenwood>
I suspect 2.3 -> 3.0 but I'm always temporally optimistic.
ReK2 has quit [Quit: Konversation terminated!]
PaulCapestany has joined #ruby
<havenwood>
Ox0dea: I'm envious of the planned pipeline parallelism stuff in Elixir 1.3. I'd love to see something along those lines in Ruby.
diegoviola has quit [Read error: Connection reset by peer]
<havenwood>
|> \o/ !!!
diegoviola has joined #ruby
cih has joined #ruby
PaulCapestany has quit [Max SendQ exceeded]
eminencehc has joined #ruby
dome22xl has joined #ruby
<Ox0dea>
havenwood: Tried Streem any?
devoldmx has joined #ruby
<havenwood>
Ox0dea: I'm the sole member of #streem! ;)
PaulCapestany has joined #ruby
j_mcnally has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cih has quit [Remote host closed the connection]
maletor has quit []
eminencehc has quit [Remote host closed the connection]
devoldmx has quit [Ping timeout: 250 seconds]
j_mcnally has joined #ruby
dome22xl has quit [Quit: Bye]
Spami has quit [Quit: This computer has gone to sleep]
tkuchiki has joined #ruby
Musashi007 has quit [Quit: Musashi007]
towski_ has quit [Remote host closed the connection]
iamjarvo has joined #ruby
wookiehangover has quit [Ping timeout: 246 seconds]
spotted1 has quit [Ping timeout: 240 seconds]
spotted has quit [Ping timeout: 255 seconds]
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dome22xl has joined #ruby
agent_white has quit [Quit: leaving]
wookiehangover has joined #ruby
bruno- has joined #ruby
ByronJohnson has quit [Ping timeout: 272 seconds]
_djbkd has quit [Quit: My people need me...]
David27 has quit [Remote host closed the connection]
baweaver has quit [Remote host closed the connection]
David27 has joined #ruby
inteq has joined #ruby
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<tejasmanohar>
|>
ByronJohnson has joined #ruby
<tejasmanohar>
Speaking of Elixir, conference right now! :)
<Ox0dea>
.=
<tejasmanohar>
|>
<tejasmanohar>
:)
amystephen has quit [Quit: amystephen]
<havenwood>
tejasmanohar: I've been doing alchemy all day. Wish I could be there...
workmad3 has joined #ruby
robbyoconnor has quit [Ping timeout: 255 seconds]
<tejasmanohar>
TIL Alchemy can explore elixir source
<tejasmanohar>
Found out when Chris discovered it during his workshop :)
<Ox0dea>
CooloutAC: #p is a method like #puts and #print, except it evaluates to the object being printed rather than `nil`.
<Ox0dea>
CooloutAC: You should install Ruby.
Flyy7 has quit [Quit: Lost terminal]
<CooloutAC>
oh i see ok so p didn't put nil, it just put hello again on the next line
<agent_white>
CooloutAC: Also make note of what Ox0dea asked (if you were in irb or not). Try out `puts "hi"` in irb, then outside the interpreter to compare return vals.
<CooloutAC>
agent_white: i get permission denied when i try that
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<CooloutAC>
so you are saying its doing that because i'm doing it in an interpreter
<CooloutAC>
so I guess i'll just ignore it for now?
<Ox0dea>
CooloutAC: No, because you're at a REPL.
<agent_white>
Ox0dea: ^
<Ox0dea>
agent_white: v
<agent_white>
Rather, CooloutAC ^
* agent_white
prepares tennis-racker
<agent_white>
racket even...
<agent_white>
CooloutAC: What Ox0dea said... ignore me saying "interpreter". That's wrong.
<Ox0dea>
CooloutAC: The printing is happening in [E], because that's just what these methods do, but the *result* of a call to #print is `nil`, which is getting displayed in [P].
jschoolcraft has quit [Ping timeout: 240 seconds]
<Ox0dea>
These methods kind of mix [P] into [E], which is the source of your confusion.
yfeldblum has joined #ruby
spotted1 has joined #ruby
<Ox0dea>
CooloutAC: In any case, do yourself a favor: ditch Codecademy, install Ruby, and do the Koans: https://github.com/neo/ruby_koans
`tim` has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
charliesome has joined #ruby
petricore has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
charliesome has quit [Client Quit]
<CooloutAC>
i'll stick with codecademy tks though
charliesome has joined #ruby
charliesome has quit [Client Quit]
<Ox0dea>
"Wading in shit builds character", they said.
<CooloutAC>
ya thats what coming in this channel is like
<CooloutAC>
all you had to do was say its because i'm using the interpreter on codecademy
<Ox0dea>
Some people.
<CooloutAC>
but you just kept going on and on making my brain hurt
<CooloutAC>
jesus christ
<agent_white>
CooloutAC: That was his first question.
<CooloutAC>
i'm just going to stick to google from now on lmao
<agent_white>
Don't worry, you'll get there :)
<Ox0dea>
Doubtful.
<CooloutAC>
agent_white: ya and he went on about this REPL shit
<CooloutAC>
confused the fuck out of me
<CooloutAC>
lmao
<agent_white>
CooloutAC: Because it's the answer to your question?
<CooloutAC>
some people just have to make things complicated.....
<CooloutAC>
agent_white: ....
paulcsmith has joined #ruby
<CooloutAC>
when i said oh its because i'm using the interpreter in codecademy, instead of him saying no and continuing to talk on and on about confusing shit
<CooloutAC>
he should of just said, yes.
<CooloutAC>
period.
<CooloutAC>
no way i'm fucking coming in here again, i'll stick with google.
CooloutAC has left #ruby ["Selakem Shalom, PEACE"]
<Ox0dea>
It'd be funny if it weren't tragic.
shmilan has quit [Ping timeout: 240 seconds]
dome has joined #ruby
<agent_white>
It'd be funny if he weren't PM'ing me.
<agent_white>
Lawdy.
<Ox0dea>
My condolences.
arescorpio has quit [Quit: Leaving.]
paulcsmith has quit [Client Quit]
<agent_white>
I wish he joined #learnprogramming instead. We're even less lenient there, actually.
tkuchiki has joined #ruby
maletor has joined #ruby
solocshaw has quit [Ping timeout: 272 seconds]
cih has joined #ruby
DanKnox has joined #ruby
Gnomethrower has joined #ruby
Gnomethrower has joined #ruby
SylarRuby has joined #ruby
fullofcaffeine has quit [Remote host closed the connection]
cih has quit [Ping timeout: 268 seconds]
nateberkopec has joined #ruby
wookiehangover has quit [Ping timeout: 240 seconds]
VeryBewitching has quit [Quit: Konversation terminated!]
wookiehangover has joined #ruby
mghaig has left #ruby [#ruby]
mxrguspxrt has joined #ruby
dome22xl has joined #ruby
ramfjord has joined #ruby
nateberkopec has quit [Ping timeout: 272 seconds]
dome has quit [Ping timeout: 246 seconds]
Torrieri has joined #ruby
Contigi has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
bronson has joined #ruby
[k- has joined #ruby
baweaver has joined #ruby
fullofcaffeine has joined #ruby
chipotle has quit [Quit: cheerio]
tsujp has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
atal421 has joined #ruby
DanKnox has quit [Ping timeout: 268 seconds]
<tejasmanohar>
Lol this guy
atal421 has left #ruby [#ruby]
jun has quit [Remote host closed the connection]
astrobunny has joined #ruby
[k- has quit [Read error: Connection reset by peer]
[k-_ has joined #ruby
<agent_white>
hoo
dionysus69 has joined #ruby
DOSHI has joined #ruby
charliesome has joined #ruby
<DOSHI>
Hii :)
charliesome has quit [Client Quit]
tk__ has joined #ruby
houhoulis has quit [Remote host closed the connection]
<DOSHI>
Any one here pro in ruby lazy enumeration?
astrobunny has quit [Remote host closed the connection]
<bnagy>
?anyone
<ruboto>
Just ask your question, if anyone has or can, they will respond.
fullofcaffeine has quit [Remote host closed the connection]
<baweaver>
Ox0dea: not a clue, beyond me.
[k-_ has quit [Read error: No route to host]
<Ox0dea>
DOSHI: Fire away.
[k- has joined #ruby
* agent_white
prepares the sandbags
charliesome has joined #ruby
<DOSHI>
? Sorry .. I'm new to IRC ... :)
workmad3 has joined #ruby
[k- has quit [Read error: No route to host]
<DOSHI>
I want to create a factorial function using lazy ... something like this
zenguy_pc has quit [Read error: Connection reset by peer]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
charliesome has joined #ruby
<Ox0dea>
DOSHI: You'll have to be a little more verbose than that, I'm afraid.
[k-_ has quit [Read error: No route to host]
<Ox0dea>
I'm not entirely sure why Lazy#inject exists, to be honest.
[k- has joined #ruby
fullofcaffeine has joined #ruby
<DOSHI>
I not sure too .. I am learning about lazy ... so I thought why not try a factorial function .. by factorial here i mean 1*2*3*4*5*6.....*n where n is an integer
workmad3 has quit [Ping timeout: 240 seconds]
dhjondoh has joined #ruby
SylarRuby has quit [Remote host closed the connection]
makman is now known as MakMan
charliesome has quit [Client Quit]
<DOSHI>
Ox0dea: p (1..5).lazy.inject { |x,y| x*y } #output 120 Works fine
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<baweaver>
inject is a value function
<baweaver>
won't work
toretore has quit [Quit: This computer has gone to sleep]
<[k->
so mathy
<bnagy>
also, you can just inject(:*) there, as ruby shorthand
DoYouKnow has quit [Changing host]
DoYouKnow has joined #ruby
DoYouKnow has quit [Changing host]
DoYouKnow has joined #ruby
<Ox0dea>
Lazy factorial is kind of silly.
<DOSHI>
baweaver: ok so only map, select, collect works for lazy and not inject or reduce ... right?
<[k->
{ x: x is part of the factorial chain of n }
<[k->
Ox0dea!
<Ox0dea>
Hiya!
mxrguspxrt has quit [Remote host closed the connection]
<baweaver>
Ox0dea: Scala because Spark, and Scala is less likely to scare the children
<certainty>
knows even
<baweaver>
echo again
<baweaver>
fancy that
<certainty>
woops
<certainty>
sorry
spotted1 has left #ruby [#ruby]
rushed has quit [Quit: rushed]
<Ox0dea>
baweaver: So, I can't get yours to work? What's this `first_four`?
<baweaver>
Ox0dea: mind you I know enough Clojure / Lisp / Scheme to be dangerous
<baweaver>
...did I typo that?
MakMan has joined #ruby
MakMan has quit [Max SendQ exceeded]
ruurd has quit [Quit: ZZZzzz…]
<Ox0dea>
Changing it to `first_thirteen` doesn't help matters. :<
<baweaver>
works for me
<baweaver>
odd.
<baweaver>
edited gist
<Ox0dea>
Ah, yeah, it's all good.
<baweaver>
I'd been testing with 4
<baweaver>
easier to trace
<Ox0dea>
I didn't bother to check the new correct answer 'til just now; I only saw that you had some zeroes in the final stack and thought that couldn't be right.
<baweaver>
ah, looks like I may be giving a talk in SF for JS code generation titled "You Type Too Much"
chipotle has quit [Quit: cheerio]
<baweaver>
covering bash/zsh aliasing, then to editor snippets/macros, then to Yeoman generators, and finishing up with hook generators for REST APIs
<baweaver>
if an API is kind enough to tell you its params and expected types, you can easily generate a client against it.
<baweaver>
well bed for me, then back to preparing talk materials. I'll rig that talk to use rails generators instead of yeoman for railsconf later :D
dionysus69 has quit [Remote host closed the connection]
baweaver has quit [Remote host closed the connection]
ruurd has joined #ruby
dionysus69 has joined #ruby
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
lubarch has joined #ruby
Ilyes512 has joined #ruby
nfk|laptop has joined #ruby
nateberkopec has quit [Ping timeout: 246 seconds]
felixr has joined #ruby
bronson has joined #ruby
codecop has joined #ruby
Soda has joined #ruby
Soda has quit [Read error: Connection reset by peer]
skade has joined #ruby
workmad3 has joined #ruby
vondruch has joined #ruby
SCHAAP137 has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
ruurd has quit [Quit: ZZZzzz…]
workmad3 has quit [Ping timeout: 246 seconds]
dome has joined #ruby
chipotle has joined #ruby
cih has joined #ruby
zomgbie has quit [Ping timeout: 250 seconds]
zeroDivisible has quit [Ping timeout: 240 seconds]
ozz has left #ruby [#ruby]
toretore has quit [Quit: This computer has gone to sleep]
Xeago has joined #ruby
dome22xl has quit [Ping timeout: 268 seconds]
ozz has joined #ruby
dionysus69 has quit [Ping timeout: 252 seconds]
ljarvis has joined #ruby
<ozz>
I'm trying to install a gem package 'rugged' on arch. I keep getting an error saying that I have to install development tools first. But I've already installed base-devel. Any one knows how to solve this?
Glenjamin has joined #ruby
<Glenjamin>
Hi all, is there any way to create an anonymous scope which doesn't leak local variables?
<apeiros>
proc { localsherearenotleaked }.call
<apeiros>
what do you need it for, Glenjamin?
<Glenjamin>
in a chef recipe, i want to share a value between only_if and ruby_block
<Glenjamin>
but not worry about namespace clashes
<Glenjamin>
proc {}.call seems reasonable enough - basically the same an as IIFE in JS
<ljarvis>
moin
firstdayonthejob has quit [Ping timeout: 268 seconds]
LBRapid has joined #ruby
<jhass>
ozz: what's the full error?
paulcsmith has joined #ruby
<Ox0dea>
apeiros, jhass: Any way to get the anonymous module from load('foo', true) without walking ObjectSpace?
<apeiros>
Glenjamin: IMO if you have an issue with local variables clashing you have a larger issue at hand anyway
chipotle has quit [Quit: cheerio]
htmldrum has quit [Ping timeout: 240 seconds]
<apeiros>
Ox0dea: with code in the loaded module. which sucks. I wish load returned it.
<Ox0dea>
For serious.
DoubleMalt has joined #ruby
<apeiros>
Ox0dea: had to come up with my own way for a plugin system of mine because of that.
<Glenjamin>
well, the correct fix is to create an LWRP
<Ox0dea>
apeiros: That's exactly where I'm at.
<Glenjamin>
but sometimes i'm lazy, and i was wondering what the band-aid version is
<apeiros>
Ox0dea: "I'm not loading modules" - the other part of what I wrote is module_eval(File.read(path), path) - which essentially means it does what load(path, true) does, just with a named instead of an anonymous module, plus I have a ref to the mod
<Ox0dea>
apeiros: Yep, I figured I'd need to resort to eval'ing strings. :/
<apeiros>
Ox0dea: require/load don't do anything else anyway
<Ox0dea>
I know, but it still feels icky.
<apeiros>
(apart from require's ability to load native extensions, of course)
dome has quit [Ping timeout: 268 seconds]
DoYouKnow has quit []
<Ox0dea>
Are you saying Ruby can't parse ELF?
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Ox0dea>
Only kidding, of course; we've got FFI.
<jhass>
ozz: so you got a 32bit box?
Soda has joined #ruby
tvw has joined #ruby
mjago has quit [Remote host closed the connection]
lubarch has quit [Read error: Connection reset by peer]
paulcsmith has quit [Ping timeout: 250 seconds]
<ozz>
jhass: yeah its a 32
<Ox0dea>
ozz: Is this a recent Arch install?
lubarch has joined #ruby
<ozz>
yup
ruurd has joined #ruby
postmodern has quit [Quit: Leaving]
<Ox0dea>
Would you consider blowing it away and starting fresh? :P
<Ox0dea>
You've managed to get it into a bad state mighty quickly.
<Ox0dea>
Seems like a multilib issue at first glance.
<Ox0dea>
What with the redefinition warnings.
zotherstupidguy has quit [Quit: WeeChat 1.2]
<jhass>
yeah, perhaps installed lib32- stuff on a 32bit system
<jhass>
ozz: pacman -Qs lib32 anything?
<ozz>
jhass: nothing
drptbl has joined #ruby
<Ox0dea>
ozz: Did you install everything from base-devel?
peteykun has joined #ruby
<ozz>
Ox0dea: went with the default all
<Ox0dea>
Pleb.
<Ox0dea>
<3
Balzrael has joined #ruby
<jhass>
I don't have a libgcc.so even
<Ox0dea>
ozz: You installed ruby-rugged from the AUR, didn't you?
mjago has joined #ruby
<jhass>
ozz: pacman -Qo /usr/lib/libgcc.so ?
<ozz>
Ox0dea: I dont remember doing it.
<Ox0dea>
But you did or didn't?
<ozz>
Ox0dea: I didnt
<ozz>
jhass: No package owns /usr/lib/libgcc.so
<Ox0dea>
Yikes.
<jhass>
well, that's not good
<jhass>
where does it come from?
<shevy>
outer space!
mike___1234 has joined #ruby
dhjondoh has joined #ruby
arup_r has quit [Ping timeout: 252 seconds]
icarus has joined #ruby
<shevy>
hmm I have no libgcc.so here
<Ox0dea>
ozz: Uh-oh. Do you use SSH?
DrCode has quit [Remote host closed the connection]
<ozz>
Anyways thanks guys (jhass Ox0dea). I'm tired of debugging this any further. I'm re installing my OS. Hopefully that should solve the problem
<dionysus69>
getting this error: Your Ruby version is 2.1.2, but your Gemfile specified 2.2.3, I am using rvm and I should have 2.2.3, I dont understand where 2.1.2 would come from at all how do I remove it and let my project see 2.2.3?
bankair has quit [Quit: WeeChat 0.3.8]
Ilyes512 has joined #ruby
lubarch has quit [Ping timeout: 268 seconds]
marr has joined #ruby
<jhass>
dionysus69: got a .ruby-version ?
<dionysus69>
meaning? ?
<jhass>
do you have a .ruby-version file in your project root
<dionysus69>
nope
<dionysus69>
just a gem file
dnewkerk has quit [Quit: dnewkerk]
<jhass>
rvm use 2.2.3 --default then I guess
<dionysus69>
it is defaulted and its selected it
<dionysus69>
but it still gets me that error
<jhass>
rvm current ?
<dionysus69>
when I write ruby -v it gives me 2.2.3 correctly
<jhass>
type -a bundle ?
<dionysus69>
rvm current tells me 2.2.3 too
<dionysus69>
bundle is /usr/bin/bundle
<jhass>
there you go, that's not good
<dionysus69>
why ? :S
<jhass>
gem install bundler
<dionysus69>
oh damn
<jhass>
that's very likely having a hashbang pointing to your system ruby
<dionysus69>
i figured it out, I installed it using aptitude
<dionysus69>
i guess I should have installed it using gem
<dionysus69>
but I had gem
<dionysus69>
ok nvm i ll try remove it
pawnbox has quit [Remote host closed the connection]
<jhass>
gem install bundler should add a proper one prior into your PATH when using RVM
ruurd has quit [Quit: Bye]
<jhass>
but sure, getting rid of the global one doesn't hurt
jud has quit [Quit: Leaving]
<dionysus69>
cool that worked, removed apt bundler installed gem and done
<dionysus69>
thanks ))
ruurd has joined #ruby
lubarch has joined #ruby
<dionysus69>
how is the ruby community's opinion about jruby?
<dionysus69>
is it stable and is it worth getting familiar to?
cih has quit [Remote host closed the connection]
sundhell has joined #ruby
zotherstupidguy has joined #ruby
G has quit [Quit: leaving]
<apeiros>
dionysus69: jruby is excellent
zotherstupidguy has quit [Client Quit]
ByronJohnson has joined #ruby
pawnbox has joined #ruby
paulcsmith has quit [Ping timeout: 240 seconds]
<apeiros>
it's better than MRI in a couple of use cases. mostly when startup time doesn't matter (server processes) and C extensions aren't an issue.
sundhell has quit [Client Quit]
<dionysus69>
ye it looks good, java has pretty rich library so if it works good then its a dream framework for some people
<apeiros>
also when you want parallelism. mri only offers concurrency.
<apeiros>
that too. when you actually want to use java libs it may also be a good choice. we e.g. use a jruby instance tethered via DRb to process PDF files
Juanchito has joined #ruby
cih has joined #ruby
Spami has joined #ruby
zomgbie has joined #ruby
<dionysus69>
hmm what is drb?
cantaberry has quit [Ping timeout: 260 seconds]
<jhass>
Ruby stdlib's RPC mechanism
<apeiros>
a way to connect ruby processes and exchange data/call methods in the remote instance
<dionysus69>
hmm nice lol i am not that advanced unfortunately
Voker57 has joined #ruby
<apeiros>
DRb is pretty easy to use
dome has quit [Ping timeout: 265 seconds]
doddok has joined #ruby
<ruurd>
dionysus69 apeiros however be advised that if you are going to use Java stuff you're bound to JRuby from that point onward.
<dionysus69>
well I will probably look into it whenever I will want some kind of GUI application
<dionysus69>
because so far I havent seen anything good about shoes
karapetyan has quit [Remote host closed the connection]
bubbys has quit [Ping timeout: 264 seconds]
arturaz has joined #ruby
karapetyan has joined #ruby
ByronJohnson has quit [Remote host closed the connection]
workmad3 has joined #ruby
zomgbie has quit [Read error: Connection reset by peer]
arturaz has quit [Remote host closed the connection]
adadada has joined #ruby
adadada has quit [Remote host closed the connection]
adadada has joined #ruby
karapetyan has quit [Ping timeout: 272 seconds]
<jhass>
ruby-gir, rwx, dunno about Qt
workmad3 has quit [Ping timeout: 240 seconds]
<dionysus69>
are those GUI frameworks?
fgo has joined #ruby
<jhass>
bindings to GUI frameworks
funkenstrahlen has joined #ruby
mikecmpbll has joined #ruby
<dionysus69>
ruby-gir? google didnt throw anything
yardenbar has quit [Remote host closed the connection]
bronson has quit [Ping timeout: 250 seconds]
based_pdev_ has joined #ruby
noodle has quit [Ping timeout: 265 seconds]
nertzy2 has joined #ruby
yardenbar has joined #ruby
symm-_ has joined #ruby
mxrguspxrt has quit [Remote host closed the connection]
fgo has quit [Quit: WeeChat 1.1.1]
headius_ has joined #ruby
ByronJohnson has joined #ruby
funkenstrahlen_ has joined #ruby
doddok has quit [Quit: Leaving]
doddok has joined #ruby
chouhoul_ has joined #ruby
dasher00 has quit [Ping timeout: 240 seconds]
Rennex_ has joined #ruby
yardenbar has quit [Remote host closed the connection]
S0da has joined #ruby
gregf__ has joined #ruby
martinbjeldbak_ has joined #ruby
sp__ has joined #ruby
ozzloy_ has joined #ruby
rapha_ has joined #ruby
jamo__ has joined #ruby
bakedb_ has joined #ruby
abyss_ has joined #ruby
agentmee1kat has joined #ruby
yardenbar has joined #ruby
dhjondoh has quit [Quit: dhjondoh]
symm- has quit [Ping timeout: 250 seconds]
headius has quit [Ping timeout: 250 seconds]
martinbjeldbak has quit [Ping timeout: 250 seconds]
peterhu has quit [Ping timeout: 250 seconds]
chouhoulis has quit [Ping timeout: 250 seconds]
perry has quit [Ping timeout: 250 seconds]
timmow has quit [Ping timeout: 250 seconds]
sp_ has quit [Ping timeout: 250 seconds]
M-prosodyContext has quit [Ping timeout: 250 seconds]
ozzloy has quit [Ping timeout: 250 seconds]
funkenstrahlen has quit [Ping timeout: 250 seconds]
finges_ has quit [Ping timeout: 250 seconds]
Soda has quit [Ping timeout: 250 seconds]
Alina-malina has quit [Ping timeout: 250 seconds]
nertzy has quit [Ping timeout: 250 seconds]
akkad has quit [Ping timeout: 250 seconds]
Morrolan has quit [Ping timeout: 250 seconds]
mprelude has quit [Ping timeout: 250 seconds]
Jamo has quit [Ping timeout: 250 seconds]
EdwardIII has quit [Ping timeout: 250 seconds]
linduxed has quit [Ping timeout: 250 seconds]
AustinMatherne has quit [Ping timeout: 250 seconds]
cescalante has quit [Ping timeout: 250 seconds]
Rennex has quit [Ping timeout: 250 seconds]
pl1ght has quit [Ping timeout: 250 seconds]
spectra has quit [Ping timeout: 250 seconds]
zenguy_pc has quit [Ping timeout: 250 seconds]
agentmeerkat has quit [Ping timeout: 250 seconds]
`based_pdev` has quit [Ping timeout: 250 seconds]
_mak has quit [Ping timeout: 250 seconds]
marens has quit [Ping timeout: 250 seconds]
rapha has quit [Ping timeout: 250 seconds]
bakedb has quit [Ping timeout: 250 seconds]
Brando753 has quit [Ping timeout: 250 seconds]
abyss has quit [Ping timeout: 250 seconds]
boshhead has quit [Ping timeout: 250 seconds]
gregf_ has quit [Ping timeout: 250 seconds]
Meeh has quit [Ping timeout: 250 seconds]
ahuman has quit [Ping timeout: 250 seconds]
crowell has quit [Ping timeout: 250 seconds]
AustinMatherne has joined #ruby
dwithers has joined #ruby
dhjondoh has joined #ruby
Morrolan has joined #ruby
Kendos-Kenlen has joined #ruby
crowell has joined #ruby
crowell has quit [Changing host]
crowell has joined #ruby
Meeh has joined #ruby
ahuman has joined #ruby
EdwardIII has joined #ruby
bubbys has quit [Ping timeout: 252 seconds]
<ruurd>
QtRuby
<ruurd>
qtbindings
boshhead has joined #ruby
zomgbie has joined #ruby
mxrguspxrt has joined #ruby
marens has joined #ruby
cescalante has joined #ruby
_mak has joined #ruby
peterhu has joined #ruby
mprelude has joined #ruby
zenguy_pc has joined #ruby
perry has joined #ruby
perry has quit [Changing host]
perry has joined #ruby
finges_ has joined #ruby
timmow has joined #ruby
linduxed has joined #ruby
Napear has joined #ruby
Hobbyboy has joined #ruby
Brando753 has joined #ruby
spectra has joined #ruby
joonty has quit [Quit: joonty]
akkad has joined #ruby
noodle has joined #ruby
skade has joined #ruby
lubarch has quit [Ping timeout: 246 seconds]
workmad3 has joined #ruby
dhjondoh has quit [Quit: dhjondoh]
dhjondoh has joined #ruby
livathinos has quit [Remote host closed the connection]
yeticry has quit [Quit: leaving]
dasher00 has joined #ruby
ledestin has joined #ruby
bubbys has joined #ruby
mxrguspxrt has quit []
charliesome has joined #ruby
paulcsmith has quit [Ping timeout: 246 seconds]
Me_Engine has joined #ruby
MakMan has joined #ruby
subshad has joined #ruby
dionysus69 has quit [Read error: Connection reset by peer]
S0da has quit [Remote host closed the connection]
platzhirsch has joined #ruby
dionysus69 has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
platzhirsch has left #ruby [#ruby]
haraoka has quit [Remote host closed the connection]
wottam has joined #ruby
charliesome has joined #ruby
platzhirsch has joined #ruby
dasher00 has quit [Ping timeout: 250 seconds]
moeabdol has joined #ruby
blackmesa has joined #ruby
charliesome has quit [Client Quit]
dhjondoh has quit [Quit: dhjondoh]
rapha_ has quit [Quit: WeeChat 1.3]
Musashi007 has quit [Quit: Musashi007]
DanKnox has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<EdwardIII>
just been flicking through ruby
<EdwardIII>
i see a lot of info about the how of symbols but not much about the why?
Musashi007 has joined #ruby
herbst has joined #ruby
nateberkopec has joined #ruby
moeabdol has quit [Ping timeout: 255 seconds]
nettoweb has joined #ruby
darkt is now known as tangentstorm
c0m0 has joined #ruby
<Radar>
why not?
nateberkopec has quit [Ping timeout: 246 seconds]
<Napear>
Someone please correct me if Im wrong... but using symbols is about managing objects in memory... there is always only the one refference to symbols
<Napear>
I think... :-)
kraljev11 has quit [Ping timeout: 268 seconds]
blaxter has joined #ruby
dasher00 has joined #ruby
Alina-malina has joined #ruby
dhjondoh has joined #ruby
David27 has quit [Remote host closed the connection]
lubarch has joined #ruby
<jhass>
EdwardIII: any background we can relate to?
davedev24 has joined #ruby
<Napear>
??
paulcsmith has joined #ruby
<jhass>
Napear: that is somewhat correct, in short Ruby guarantees that :foo.object_id == :foo.object_id will always be true
<jhass>
no matter how you construct :foo
<EdwardIII>
jhass: my background? i've done a lot of php, python and some perl dev
Musashi007 has quit [Quit: Musashi007]
<jhass>
mmh, dunno about perl but the other two don't have enums :/
<Napear>
jhass: thanks
<EdwardIII>
and some C#
TheHodge has quit [Quit: Connection closed for inactivity]
jenrzzz has joined #ruby
stamina has joined #ruby
<jhass>
so in Ruby you use symbols mostly for when you'd use an enum or magic numbers elsewhere
<jhass>
it's an identifying value
lkba_ has joined #ruby
Lycanii has quit [Remote host closed the connection]
<EdwardIII>
but unlike most enums it's standalone, doesn't need to belong to a collection?
claw has joined #ruby
<jhass>
yes, or it's one single huge enum if you will
skade has quit [Ping timeout: 246 seconds]
<jhass>
as said Ruby guarantees that only one instance ever exists in memory, which makes comparing a symbol to a symbol very cheap, thus it's good for hash keys and such too
lkba has quit [Ping timeout: 250 seconds]
bronson has joined #ruby
<EdwardIII>
mmm ok
<jhass>
as a rule of thumb use a string if you care about the string value, say you plan operations such "foo".downcase or "foo".size == 3
<EdwardIII>
it's funny because a lot of people who release ruby apps tend to use ruby as the config language too
<EdwardIII>
and that was always confusing heh
<jhass>
use a symbol if you plan to use it as an identifier, that is for operations like foo == :foo, case foo; when :bar; some_hash[:baz]
<EdwardIII>
3 seconds of reading the docs cleared up what it was used for
<EdwardIII>
right
<EdwardIII>
i think i might dl a couple of frameworks and have a play
<jhass>
and another rule of thumb: in doubt use a string
<EdwardIII>
ruby seems kinda smalltalkey a little bit looking at some of the docs, like the continuous-passing and super-object-fest
monq has joined #ruby
yfeldblum has quit [Ping timeout: 246 seconds]
Ilyes512 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bronson has quit [Ping timeout: 240 seconds]
arup_r has joined #ruby
<EdwardIII>
one thing sounded a bit dodgy: one of the ruby intro docs on the website says that rails monkey patches Fixnum to get some additional functionality
<EdwardIII>
is that fairly common in the community?
<jhass>
rails (well, a part of it, activesupport) patches basically every core class in existence
konsolebox has quit [Quit: Leaving]
<jhass>
that library is specifically done to do that, so it's its contract to do so
<jhass>
randomly patching your needs in is not so common, thankfully
blaxter has quit [Ping timeout: 240 seconds]
RealMarc has joined #ruby
nfk|laptop has joined #ruby
DanKnox has joined #ruby
HammyJammy has joined #ruby
ruurd has quit [Quit: ZZZzzz…]
Rickmasta has joined #ruby
JammyHammy has quit [Ping timeout: 252 seconds]
Me_Engine has quit [Quit: ChatZilla 0.9.92 [Firefox 40.0.3/20150826023504]]
relix has joined #ruby
devoldmx has joined #ruby
agent_white has quit [Quit: night]
jun has quit []
herbst has quit [Remote host closed the connection]
davedev24 has quit [Read error: Connection reset by peer]
davedev24 has joined #ruby
bluOxigen has joined #ruby
blueOxigen has quit [Ping timeout: 264 seconds]
bruno-_ has joined #ruby
devoldmx has quit [Ping timeout: 272 seconds]
j_mcnally has joined #ruby
<EdwardIII>
ah OK
<EdwardIII>
i've had some headaches from monkey patching in JS projects before
bruno- has quit [Ping timeout: 264 seconds]
funkenstrahlen_ has left #ruby ["WeeChat 1.1.1"]
paulcsmith has quit [Ping timeout: 246 seconds]
blaxter has joined #ruby
j_mcnally has quit [Client Quit]
<BrazenBraden>
i have a ruby project comprising of scripts which do work and send emails and such (no rails). looking for a good mail queue gem (like Rescue Mailer) but is for plain ruby code. any suggestions? (i am using gem mail for email sending)
K1MOS has joined #ruby
<jhass>
maybe just run a generic queue? resque, sidekiq, delayed_job, ...
bluOxigen has quit [Ping timeout: 246 seconds]
bluOxigen has joined #ruby
Kendos-Kenlen has quit [Quit: Konversation terminated!]
charliesome has joined #ruby
Ilyes512 has joined #ruby
<BrazenBraden>
jhass, will research if those suite my needs.
felixr has quit [Ping timeout: 268 seconds]
Kendos-Kenlen has joined #ruby
OrbitalKitten has joined #ruby
monq has quit [Quit: monq]
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
beast has joined #ruby
Me_Engine has joined #ruby
iateadonut has joined #ruby
joonty has joined #ruby
doddok has quit [Ping timeout: 268 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
allcentury has joined #ruby
doddok has joined #ruby
haasn has quit [Ping timeout: 264 seconds]
riskish has joined #ruby
riskish has quit [Remote host closed the connection]
rodfersou has joined #ruby
Coldblackice has quit [Ping timeout: 240 seconds]
charliesome has joined #ruby
rubybeginner has joined #ruby
timonv has joined #ruby
dionysus69 has quit [Read error: Connection reset by peer]
Anti-Pizza has quit [Read error: Connection reset by peer]
favadi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dionysus69 has joined #ruby
keen___________2 has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
paulcsmith has joined #ruby
ghormoon has quit [Read error: Connection reset by peer]
bluOxigen has quit [Ping timeout: 244 seconds]
dhjondoh has quit [Quit: dhjondoh]
ghormoon has joined #ruby
keen___________1 has quit [Ping timeout: 255 seconds]
<jhass>
[k-: is just trying to impress with their haskell knowledge, fine to ignore
banister has quit [Read error: Connection reset by peer]
<shevy>
yeah ignore haskell
ruurd has joined #ruby
<adaedra>
ruby-lang255: all methods are called on an object. When you do foo.bar, you call bar on foo. In all methods, there is an implicit argument, "self", which represent the object you call the method on, in the foo.bar sample, foo.
<ruby-lang255>
well, is that going to help me finally understand this whole object oriented programming concept, so that ultimately I will be able to split an array into smaller pieces?
p0wn3d__ has joined #ruby
arup_r has joined #ruby
universa1 has quit [Remote host closed the connection]
<jhass>
nobody said you need to fully grasp OOP to do that
<shevy>
an array is an object
<jhass>
you already found each_slice, that's all you need
<mikecmpbll>
i want you to write a book on OOP before approaching this array task please
<shevy>
.each_slice is a method
tier has joined #ruby
<ruby-lang255>
it's a function. Or subroutine, if you will.
yardenbar has quit [Remote host closed the connection]
<ruby-lang255>
well, let me just read what shevy linked
<shevy>
there even is a class Method
s00pcan has joined #ruby
<shevy>
to make things more complicated
<jhass>
shevy: not sure that's helping atm...
<mikecmpbll>
lol
joonty has quit [Quit: joonty]
<mikecmpbll>
i don't even think that SO answer will help.
<jhass>
yeah
<shevy>
you will see
Soda has joined #ruby
<ruby-lang255>
read it, it didn't make sense
<mikecmpbll>
too concerned with Method, lambda, proc.
<mikecmpbll>
ruby-lang255: have you ever seen a class definition?
<shevy>
well it's hard to make a method more complicated than it is!
<jhass>
ruby-lang255: can you summarize what you understood so far? does the term object make some rough sense in the docs to you by now? if so you (and we) should just move on
<ruby-lang255>
thanks, yea, shevy said so too yesterday
<shevy>
not just yesterday, literally since months
<mikecmpbll>
heh
<ddv>
maybe apeiros should explain the kick method :p
<jhass>
bnagy: shall we point out that both are methods in Ruby? :P
<ruby-lang255>
eh? the only thing I came here was a programming ppl yesterday
<ruby-lang255>
programming problem*
<jhass>
ruby-lang255: could you answer my question please?
<bnagy>
jhass: :| y u do dis
<ruby-lang255>
I can understand so far that there are things you call objects, methods and so on.
<mikecmpbll>
lol.
<ruby-lang255>
The term object does not make sense in the docs to me.
<A124>
Maybe read up poignants guide or so.
sundhell has joined #ruby
<ruby-lang255>
sorry for being late on that, jhass
<[k->
do you know the English definition of object?
Antiarc has quit [Ping timeout: 244 seconds]
<ruby-lang255>
well, can search it in Oxford dic, just a moment
<jhass>
ruby-lang255: mmh, that's not much tbh, did you actually think about the explanations you've been given, I do have to wonder
<ruby-lang255>
jhass, I thought about them, but they don't clarify much if anything
<[k->
well, he doesn't know what object means, that's the problem
paulcsmith has joined #ruby
<shevy>
objects are the working units in ruby
<A124>
I once came upon Ruby, somehow discarded that.. and then again in 2008. I loved the way it works. Objects, methods, it just felt so natural to .. nature and logic. So there I was. Objects are analogic to objects in real life.
<ruby-lang255>
and what are they working on?
<A124>
Methods are the "stuff" you make with them or happen to them.
<[k->
actions
<ruby-lang255>
okay, so that's the other way, objects are worked on
Xeago has quit [Remote host closed the connection]
<bnagy>
if you have a dishwasher, it's an object and the buttons are methods
<[k->
a boooooook
<mikecmpbll>
now you know how to create them, you don't need to know what they are, abstractly, now go forth and write programs!
<shevy>
god, have you never looked how cars are made in a factory? you put stuff in, a car comes out, then you can car.drive around
<bnagy>
shevy: whoa whoa let's not get too technical here
<ruby-lang255>
So if I have an object, I can tell it what to do without actually describing how to do it?
<[k->
mikecmpbll whoa whoa let's not ignore concepts here
jokester has joined #ruby
<ruby-lang255>
that sounds very prolog-like, if anything
<mikecmpbll>
he can't understand concepts :(
<[k->
ruby-lang255: what's your background?
<jhass>
ruby-lang255: let's make this practical. Go solve your problem, read the docs. If you have a concrete thing in the docs you don't understand come back and ask about that concrete example
<shevy>
he is just having fun trollolling
<A124>
And classes themselves are objects. For example you have a class cat .. that is whole system. Inside that class youhave the inner workigns of cat and you expose the methods (actions) and other objects. Then when you want a new cat named Timmy and act upon that cat you crate an instance of that class (timmy = Cat.new) and then you make actions upon it that were either inherited or defined in that class.
<A124>
ruby-lang255 Helped even a little bit?
prestorium has quit [Quit: Leaving]
prestorium has joined #ruby
<A124>
You can imagine everything in Ruby as a "box".
<A124>
Even the Ruby interpretor is a box.
<ruby-lang255>
no, and shevy's claims are tending to the offensive. Yesterday he was crying "post code or gtfo", and then I did, then "moar code!", and then I did; and now I'm coming back today, and once again he cries "troll"
* mikecmpbll
throws the troll a dead goat
<jhass>
ruby-lang255: let's just do what I said and I promise it'll stop
<A124>
Well, apparently knowledgable people get often heated up by trolls or people that are on a troll level. I know that a lot ... from other chans.
<A124>
Read a guide. Search poignant guite to ruby.
<ruby-lang255>
jhass, but the docs are several hundreds of pages, and filled with concepts/words which I don't grasp
SylarRuby has quit []
dnewkerk has joined #ruby
<A124>
Read a guide.
<mikecmpbll>
what do you do when you get to a work in a novel that you don't understand?
<jhass>
ruby-lang255: I'm not saying read them like a book, search through them for a concrete problem
<mikecmpbll>
you work it out from the context or you look it up
<mikecmpbll>
s/work/word
<jhass>
ruby-lang255: you try to discuss things in the abstract but reject and abstract explanations and analogies given
<jhass>
that just doesn't work, not for you and not for us
<ruby-lang255>
no, I want simply solutions to what I'm trying to program but I know not how. I could program it in fortran, except that fortran doesn't do no HTTPS gets
<mikecmpbll>
lol
lele|w has quit [Remote host closed the connection]
<ruby-lang255>
I don't want their absolute value or sum them up
darkhex has joined #ruby
dionysus70 has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
dionysus70 is now known as dionysus69
<jhass>
you have a great talent in saying what you don't want without ever leaking a detail about what you do want. Stop it. Come back with a concrete problem ("I tried this to achieve this other concrete thing but it does this other thing instead")
* A124
is waiting for dist-upgrade t finish
ivanf has quit [Ping timeout: 265 seconds]
<ruby-lang255>
what I want is this. I have a list/array of numbers. I need to make a HTTPS request on them to a server, through a CGI where the list of numbers goes behind a question mark. The server responds with a JSON, which I need to examine whether or not they're fitting certain conditions, then put them in an array
<ruby-lang255>
but only those which match the conditions
wpp has joined #ruby
<jhass>
that's only the middle part, missing 1 & 3
<ruby-lang255>
the CGI enables up to 200 requests for numerical IDs to be made at once
headius_ is now known as headius
ivanf has joined #ruby
* jokester
smells potential potential vulnerability in the air
<jhass>
ruby-lang255: what you tried so far and what it does instead
decoponio has joined #ruby
<jhass>
1) attempt, 2) desired outcome 3) actual outcome
northfurr has joined #ruby
Antiarc has joined #ruby
rushed has quit [Quit: rushed]
<jhass>
that makes a great question that will get you a great and effective answer
adadada has quit [Ping timeout: 264 seconds]
<jhass>
instead of all this meta bullshit that you're not really willing to invest into anyway
dionysus70 has joined #ruby
<ruby-lang255>
1) tried getting them one by one. 2) getting the list filled 3) the list is getting filled eventually but due to the https session overhead, it being established ~70000 times, it's slow like hell
<jhass>
1) involves code in 90% of the cases
<ruby-lang255>
(been running for about 7 hours now and still counting.. 43k currently)
dandrade has joined #ruby
<[k->
Array is inefficient for large datasets if you are going through every single element of it to find a single elemebt
<jhass>
[k-: thanks for no contribution
<ruby-lang255>
well, the code was provided by somebody on this channel yesterday. I don't quite know how it does what it does, but at any rate it seems to be doing it
dionysus69 has quit [Ping timeout: 265 seconds]
dionysus70 is now known as dionysus69
<jokester>
rapha: the answer creates a new object which wraps the original logger with fancy lines
<bnagy>
it sounds like you should hire a programmer
nolic has joined #ruby
tno has joined #ruby
<jhass>
ruby-lang255: it was me and I simply rephrased your logic, it's still your logic
<jokester>
are you calling #warn on the new object? can we see the code?
yardenbar has joined #ruby
<A124>
ruby-lang255 PM me if you want personal help, got some time and maybe even patience.
<A124>
Also how many requests only 70k?
<[k->
I'm not really following what his problem is in the first case, array + selection + many elements + slowness = ???
<A124>
Also most servers you should wait to let other users use the site, or autobans occur.
<A124>
[k- SSL negotiation and RTT connection overhead, at least he thinks that.
<ruby-lang255>
A124, that happened so I added a random delay timer. Which obviously doesn't speed things up at all
<ruby-lang255>
and searched and copied some bits that handle 502 and similar messages
<bnagy>
sounds like idx_list.each_slice(200).map {|s| parse_json(do_api_req(s)).compact}.each {|result| insert(result)}
zomgbie has quit [Ping timeout: 240 seconds]
<ruby-lang255>
and one Net::ReadTimeout
<jokester>
(what) is being eatablished many times? TCP connection or SSL session?
rubybeginner has quit [Ping timeout: 260 seconds]
<jhass>
ruby-lang255: .each_slice and .join will allow you to build up the parameter list with two changed lines (and probably another .each depending the response), I don't think you attempted anything yet to solve your current problem
_el_fer_ has joined #ruby
<A124>
ruby-lang255 PM me about it or silence.
<A124>
You are getting annoing on the channel, sorry to say.
darkhex has quit [Read error: No route to host]
Napear has quit [Quit: leaving]
p0wn3d_ has joined #ruby
OrbitalKitten has joined #ruby
gwendall has joined #ruby
northfurr has quit [Quit: northfurr]
dandrade has quit [Read error: Connection reset by peer]
yardenbar has quit [Remote host closed the connection]
nsuke has joined #ruby
cih has quit [Remote host closed the connection]
p0wn3d__ has quit [Ping timeout: 240 seconds]
cantaberry has quit []
last_staff has quit [Quit: last_staff]
<shevy>
that is the real purpose of a troll
yardenbar has joined #ruby
TvL2386 has quit [Ping timeout: 252 seconds]
wookiehangover has quit [Ping timeout: 240 seconds]
yardenbar has quit [Remote host closed the connection]
<jhass>
shevy: just drop it, turn away if you feel annoyed but don't fuel the heat
<DylanJ>
hi guys. if i have [{'x':1}, {'x':2}, .. {'x':'foo'}] - are there any tricks to get this array? [1,2,..,'foo']? just curious if there's something shorter than arr.map{|h|h['x']} => [1,2,..,'foo']. ty
karapetyan has quit [Remote host closed the connection]
<[k->
Hash#values does this
<mustmodify_>
DylanJ: Glad you provided your own solution. When I started reading I was like, "Homework!!!" Could be because I have a teenager named Dylan. LOL.
<shevy>
isn't that already short?
karapetyan has joined #ruby
deavid has joined #ruby
<mustmodify_>
It's short but much less readable than #values
karapetyan has quit [Remote host closed the connection]
<mustmodify_>
well
bronson has joined #ruby
<shevy>
you even optimized a ' ' away when you wrote arr.map{ rather than arr.map {
<mustmodify_>
he has an array of hashes.
<shevy>
:D
<mustmodify_>
so you would want
karapetyan has joined #ruby
<mustmodify_>
array.map(&:values).flatten
<shevy>
longer!
A124 has quit [Quit: '']
SCHAAP137 has quit [Remote host closed the connection]
ndrei has joined #ruby
TheWhiteOx has quit [Client Quit]
<shevy>
good that he uses the key 'x'
<mustmodify_>
more readable?
<mustmodify_>
YMMV
<mustmodify_>
I like shorter but not at the expense of expressing intent.
<avdi>
using #values assumes that there are only values of 'x', no values of 'y' that need to be extracted separately
<DylanJ>
mustmodify_: i know ruby ;). for instance if i had [a,b,c] where a,b,c were objects that had the method `x` then i could have done arr.map(&:x) - since you can call a method on the object you're yielding to. i don't know how to pass an argument to that though. and maybe it's possible with tricks.
<shevy>
nah you can't pass an argument to &:x sadly
<DylanJ>
QQ
<shevy>
perhaps in ruby 3.0
patchedmonkey has joined #ruby
bronson has quit [Ping timeout: 250 seconds]
moeabdol has joined #ruby
Me_Engine has joined #ruby
relix has quit [Read error: Connection reset by peer]
<avdi>
unlikely. Ruby isn't like JavaScript; it doesn't treat subscripting and object methods as nearly identical.
relix has joined #ruby
slawrence00 has joined #ruby
<glider>
part
Me_Engine has quit [Client Quit]
glider has quit [Quit: Page closed]
naftilos76 has joined #ruby
<avdi>
You can get the desired behavior with an extra step of converting all the hashes to ostructs
<avdi>
DylanJ: well yeah, I can show you all kinds of stuff like that. There's a very simple Array#to_proc extension I've been tempted to submit as Ruby patch.
samukasmk has quit [Ping timeout: 255 seconds]
<DylanJ>
Do you have some of that posted anywhere?
sanjayu has quit [Read error: Connection reset by peer]
That_noob has joined #ruby
<jhass>
I still like Crystals syntax rewrite, .map &.["x"] or .map &.fetch("x")
<avdi>
DylanJ: oh, BTW, some of us here aren't guys :-)
<Coraline>
Thanks avdi
bruno- has quit [Read error: Connection reset by peer]
bruno- has joined #ruby
eminencehc has joined #ruby
kies has quit [Ping timeout: 256 seconds]
patchedmonkey has joined #ruby
<DylanJ>
Obviously by me saying guys I was addressing my question to the men of the channel. /me rollseyes. Sorry for not being politically correct.
j_mcnally has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sanjayu has quit [Read error: Connection reset by peer]
moeabdol has joined #ruby
<mustmodify_>
<echo-voice>ONLY MANLY MEN MAY ANSWER THE QUESTIONS I POSE.</echo-voice> -some religious guy
bruno- has quit [Read error: Connection reset by peer]
<Coraline>
Nice attitude
ldnunes has quit [Ping timeout: 240 seconds]
<avdi>
DylanJ: I don't care about PC. I care about my friends, and how they feel when people use needlessly male-centric language in a field that is already needlessly male dominated. I wouldn't like it if I were them, so I don't like it on their behalf.
bazbing80 has joined #ruby
NeverDie has joined #ruby
ldnunes has joined #ruby
<mikecmpbll>
uhmm, this is the weirdest thing
<mustmodify_>
avdi: I don't want to go too far OT but I really wish our language had more gender-neutral pronouns or ... I'm not sure guys is a pronoun as much as a pseudo-pronoun.
RobertBirnie has joined #ruby
<mikecmpbll>
i'm not doing anything and my Gemfile.lock keeps reverting
<avdi>
I say "folks". It works great.
<mustmodify_>
ah yep, that's a good one.
bruno- has joined #ruby
<bazbing80>
is there an initialize function for modules? So whenever I include module A, certain methods inside module A are included automatically?
<mustmodify_>
mikecmpbll: first guess... check your assumptions.
<eam>
DylanJ: don't worry about it, "guys" is not a gender specific term
tommylommykins has quit [Remote host closed the connection]
<eam>
this is all just signaling
<mustmodify_>
bazbing80: yep. I think it's "included" but not sure.
leat has joined #ruby
<mikecmpbll>
i've checked everything i can think of. 1 sec making a gist
<avdi>
eam: yes, it couldn't possibly be because I care about how people feel.
patchedmonkey has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
banister has quit [Read error: Connection reset by peer]
terlar has quit [Ping timeout: 246 seconds]
<bazbing80>
mustmodify_: awesome...just adding a ruby question. you know, because this is #ruby :P
j_mcnally has joined #ruby
tommylommykins has joined #ruby
<mustmodify_>
I mean, when I emit "guys" I mean it gender-neutrally, in the same way that we take "all men are created equal" and "where no man has gone before" to mean mankind. (whether that was the original intent or not.) But I think pushing back there is culturally useful.
<jhass>
.inject(0) {|sum, elem| next unless elem.is_a? Hash; sum + elem["am"].to_i + elem["pm"].to_i } for the no intermediate arrays version
<jhass>
er, next sum
treehug88 has joined #ruby
ruurd has quit [Client Quit]
<ljarvis>
map(&method(:Array)).flatten.map(&:to_i).inject(:+) # who cares about non-ints :D
karapetyan has quit [Ping timeout: 240 seconds]
ruurd has joined #ruby
niftylettuce has joined #ruby
towski_ has joined #ruby
<Diabolik>
jhass
<Diabolik>
i did do the _
leafybasil has quit [Remote host closed the connection]
elperdut_ has quit [Ping timeout: 240 seconds]
<imperator>
dumb regex question i seem incapable of handling today
<imperator>
given id = "/subscriptions/xyz/resourceGroups/mygroup/providers/yadayada"
bricker has joined #ruby
devoldmx has joined #ruby
<imperator>
why isn't id[/\/resourceGroups\/(.*?)\/\1/] giving me "mygroup" ?
rubybeginner has joined #ruby
elperdut_ has joined #ruby
rodfersou is now known as rodfersou|lunch
Lucky__ has joined #ruby
cirenyc has joined #ruby
barhum2013 has joined #ruby
<jhass>
uh, well, why would it?
dfockler has joined #ruby
<jhass>
why the backreference?
<imperator>
bah, wrong paste
kidoz has joined #ruby
<loincloth>
imperator: backref is confusing yeah but if you want a capture from #[] you need the second arg for which capture
Kendos-Kenlen has quit [Quit: Konversation terminated!]
ruurd has quit [Quit: ZZZzzz…]
favadi has joined #ruby
devoldmx has quit [Ping timeout: 246 seconds]
Mon_Ouie has joined #ruby
rubybeginner has quit [Ping timeout: 260 seconds]
kinlo has joined #ruby
favadi has quit [Max SendQ exceeded]
bronson has joined #ruby
favadi has joined #ruby
nfk has joined #ruby
maletor has joined #ruby
favadi has quit [Max SendQ exceeded]
amclain has joined #ruby
mistermocha has joined #ruby
favadi has joined #ruby
JDiPierro has quit [Remote host closed the connection]
<kinlo>
what's the proper way to implement a producer/consumer pattern? I've tried using a Queue (from the thread package) but when I try to read from the same queue with multiple threads, it seems that consumers get the same data - not being thread safe
joonty has quit [Quit: joonty]
favadi has quit [Max SendQ exceeded]
mikecmpbll has quit [Ping timeout: 240 seconds]
chipotle has joined #ruby
<jhass>
that seems unlikely, code?
ruurd has joined #ruby
<kinlo>
let me dumb down my example, give me 5 min
mistermocha has quit [Client Quit]
<jhass>
take your time
casadei has quit [Remote host closed the connection]
<bazbing80>
methods created by attr_reader are inherited no problem so...
<jhass>
bazbing80: I don't think you ran your example
<jhass>
but something else
favadi has quit [Max SendQ exceeded]
finisherr has joined #ruby
<bazbing80>
jhass: true, error message should be undefined method 'set_default_val' for MyClass
<jhass>
but yeah, those fake stuff hides your real problem
favadi has joined #ruby
<jhass>
included is run when there's no single instance yet, so you can't act upon instances from there
araujo_ has joined #ruby
<bazbing80>
jhass I wouldn't say "fake" it's making the problem as clear and as consise as possible IMHO...but yeah what I want is impossible to achieve?
<jhass>
you have to lazily define the instance vars (def value; @value ||= 42; end;), define initialize and call super in the including's class initialize or define initialize call super and prepend the module
Xeago has quit [Remote host closed the connection]
skweek has quit [Ping timeout: 244 seconds]
senayar has quit [Remote host closed the connection]
jamesaxl|2 is now known as jamesaxl
<Porfa>
shevy: timestamp, i'm halfway through the book, DID YOU KNOW there's something called GETS? i can drop all those lazy argv's inputed form the command line… thank you for telling me to learn some methods :p
rdark has quit [Quit: leaving]
_djbkd has quit [Remote host closed the connection]
_djbkd has joined #ruby
NeverDie has joined #ruby
TomyLobo has joined #ruby
sanjayu has quit [Read error: Connection reset by peer]
Xeago has quit [Remote host closed the connection]
eminencehc has quit [Remote host closed the connection]
allomov has joined #ruby
craysiii has joined #ruby
lxsameer has joined #ruby
shmilan has joined #ruby
Guest53 has joined #ruby
baweaver has joined #ruby
niro has quit [Quit: WeeChat 0.4.2]
pangur has joined #ruby
eminencehc has joined #ruby
benlieb has joined #ruby
DLSteve has quit [Quit: Leaving]
matp has quit [Remote host closed the connection]
anisha has quit [Quit: Leaving]
<pangur>
I am using Sinatra with Sequel to construct a very basic app. I have a table districts which has two fields: id and label. Label is a string such as 23A, which has an id of 21. I want to be able to do localhost:4567/district/23A and yield the id (21) of the district found. Any tips on how to do that please. The labelling is important to other people, so I cannot ditch it in favour of the id that I use.
dvlcloud has quit [Quit: Connection closed for inactivity]
dorei has quit [Remote host closed the connection]
matp has joined #ruby
_djbkd has joined #ruby
rushed has joined #ruby
Oka has joined #ruby
<toretore>
get('/district/:label'){ sql('select id from districts where label = ?', params[:label])['id'] }
<pangur>
thanks, toretore.
* pangur
goes to try that
haylon has quit [Quit: Leaving]
dorei has joined #ruby
codecop has quit [Remote host closed the connection]
`tim` has joined #ruby
SCHAAP137 has joined #ruby
<pangur>
toretore: I am a little confused as to how to use this.
SCHAAP137 has quit [Changing host]
SCHAAP137 has joined #ruby
RegulationD has quit [Remote host closed the connection]
<pangur>
I understand that get('/district/:label') should be the route?
p0wn3d_ has joined #ruby
jmallen has joined #ruby
eam has joined #ruby
<pangur>
Where does the code within the braces go, please?
naftilos76 has quit [Ping timeout: 246 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
fsociety has joined #ruby
<pangur>
Do I do @district = District.where { sql('select id from districts where label = ?', params[:label])['id'] }
fsociety is now known as Guest23876
* pangur
is sorry to be so ignorant
Guest23876 is now known as gnome
rushed has quit [Quit: rushed]
<toretore>
get('/district/:label') responds to a GET request to /district/:label, then puts whatever :label is into params[:label]
jmallen has left #ruby [#ruby]
<gnome>
How come ruby is able to detect gems when the gems directory isn't in its load path?
<toretore>
the body of the response is whatever the associated block returns
sdothum has joined #ruby
zendrix has joined #ruby
<pangur>
OK, toretore. I shall try my best to have another stab at that :)
<toretore>
what the block returns is up to you. use params[:label] to get the data from the table and return the value
nb_bez___ has joined #ruby
CanTonic has joined #ruby
eminencehc has quit [Remote host closed the connection]
Xeago has joined #ruby
<mjago>
pangur: break it down into bits that you can validate as you go maybe: label to id
drptbl has quit [Ping timeout: 240 seconds]
_djbkd has quit [Remote host closed the connection]
`tim` has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<pangur>
mjago, thanks. I am trying to work it out.
Juanchito has quit [Quit: Connection closed for inactivity]
inoperable has joined #ruby
moeabdol has quit [Ping timeout: 252 seconds]
michael_mbp has quit [Excess Flood]
NeverDie has joined #ruby
<kubunto>
nvm
kubunto has left #ruby [#ruby]
michael_mbp has joined #ruby
bobTHEknob has joined #ruby
allomov has joined #ruby
subscope has quit [Read error: Connection reset by peer]
<bobTHEknob>
I'm trying to make a class that can get a key reference to a get and set method in dot-notation and recursively read/set the variable. Is there anything like that out there?
dfockler has quit []
niftylettuce has quit [Quit: Connection closed for inactivity]
mary5030_ has joined #ruby
dcarmich has joined #ruby
freerobby has joined #ruby
Xeago has joined #ruby
Asher has quit [Ping timeout: 264 seconds]
shinnya has joined #ruby
yqt has quit [Ping timeout: 260 seconds]
jgt has quit [Read error: Connection reset by peer]
model-help has joined #ruby
weemsledeux has joined #ruby
davo_ has joined #ruby
<model-help>
If I have a category of prices, a table of products, what's the best way to represent that model? Would it be:
baweaver has joined #ruby
<model-help>
Product has_one price
<model-help>
and
<model-help>
Price belongs_to product
<model-help>
and price has a tier and a value?
mary5030 has quit [Ping timeout: 255 seconds]
<Radar>
model-help: ?rubyonrails
<Radar>
?rails
<ruboto>
Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
Xeago has quit [Remote host closed the connection]
<model-help>
?rubyonrails
<ruboto>
I don't know anything about rubyonrails
podman has joined #ruby
<model-help>
how do I join ruby on rails? thanks!
mary5030_ has quit [Remote host closed the connection]
mary5030 has joined #ruby
soundslave- has joined #ruby
soundslave- has left #ruby ["Leaving"]
<iamayam>
type /join #RubyOnRails
Xeago has joined #ruby
sanjayu has quit [Ping timeout: 264 seconds]
Papierkorb has joined #ruby
evanjs has quit [Remote host closed the connection]