<sdegutis>
drbrain: so if i want to build ruby and package it with my app, which might be anywhere on a user's system, i should build with $prefix as . and $DESTDIR as . too?
knu has quit [Remote host closed the connection]
<drbrain>
sdegutis: there's a separate configuration option you need to set for a relocatable ruby
<sdegutis>
oh
<drbrain>
I think --enable_load_relative
<drbrain>
yes
<jonthewayne>
trying to wrap my head around naming a rails controller class that's in a namespace. Would module Api module V1 class SessionController be the same as Api::V1::SessionsController?
wmoxam has quit [Ping timeout: 264 seconds]
<drbrain>
sdegutis: I would set DESTDIR to a directory inside your package build directory and prefix to something like "ruby" or "ruby-2.0.0"
mootpointer has joined #ruby-lang
shinnya has quit [Ping timeout: 264 seconds]
glebm has quit [Quit: Computer has gone to sleep.]
chinaboy_rubyfan has joined #ruby-lang
chinaboy_rubyfan has quit [Client Quit]
jtw has quit [Ping timeout: 250 seconds]
knu has joined #ruby-lang
glebm has joined #ruby-lang
Newbie0086 has quit [Ping timeout: 264 seconds]
<sdegutis>
drbrain: hmm interesting
<sdegutis>
is this room logged anywhere?
hakunin_ has quit [Remote host closed the connection]
sdegutis has quit [Remote host closed the connection]
<jonthewayne>
hey dr brain, how are you?
fuhgeddaboudit has joined #ruby-lang
<drbrain>
fine
mistym has quit [Remote host closed the connection]
<jonthewayne>
heh, cool. mind if I ask you a question?
<drbrain>
not at all
<jonthewayne>
trying to wrap my head around naming a rails controller class that's in a namespace. Would module Api module V1 class SessionController be the same as Api::V1::SessionsController?
mistym has joined #ruby-lang
<drbrain>
that's what I've seen a couple of the apps I've worked on do
<drbrain>
I'm not current on best practices in Rails
<drbrain>
#ror may have a proper answer for you
<jonthewayne>
ah, cool. thanks!
havenwood has quit [Remote host closed the connection]
rickruby has joined #ruby-lang
<mootpointer>
jonthewayne: I'm assuming there's a typo there.
<mootpointer>
SessionController vs SessionsController.
<jonthewayne>
oh yeah, that is a typo...besides that though, the two approaches are the same, right?
fuhgeddaboudit has quit [Ping timeout: 264 seconds]
io_syl has quit [Ping timeout: 240 seconds]
<mootpointer>
jonthewayne: Correct.
<jonthewayne>
thanks mootpointer!
iliketurtles has joined #ruby-lang
gix- has quit [Quit: Client exiting]
gix has joined #ruby-lang
ledestin has quit [Quit: ledestin]
utkanos has joined #ruby-lang
<utkanos>
hello, if I have a multidimensional byte array (output of a transpose) and I wish to make the end result an array whose cells have the rejoined chars into a string, what is the best way to iterate this? this works for example, but I wish to do this for all cells... trans[0].map {|x| x.chr}.join
ffio has quit [Quit: WeeChat 0.4.1]
crazyhorse has quit [Ping timeout: 264 seconds]
banister`sleep has quit [Remote host closed the connection]
sdegutis has joined #ruby-lang
sdegutis has quit [Changing host]
sdegutis has joined #ruby-lang
thepumpkin has quit [Remote host closed the connection]
nathanstitt has quit [Quit: I growing sleepy]
<utkanos>
I solved it, nevermind, thanks
utkanos has left #ruby-lang [#ruby-lang]
<sdegutis>
drbrain: does this look right? "DESTDIR=ruby21 ./configure --enable-load-relative --prefix=~/Desktop/built"
<drbrain>
I think -enable_load_relative
<drbrain>
--enable_load_relative
<drbrain>
check ./configure --help
<sdegutis>
its --enable-load-relative here
<sdegutis>
but DESTDIR should be an env-var?
<sdegutis>
i dont see an option for it in ./cofigure
<sdegutis>
gofigure
<sdegutis>
;)
<drbrain>
I think it should be an env var, but I've never used it ☹
<sdegutis>
heh
<sdegutis>
here goes nothin
rwk1 has quit [Remote host closed the connection]
yatish27 has joined #ruby-lang
lsegal has joined #ruby-lang
<sdegutis>
so, turns out that if you git clone with --depth 1, make fails with bigdecimal error. but without that, make works
<sdegutis>
so, yeah.
hakunin has joined #ruby-lang
dhsmith_ has joined #ruby-lang
<ryanf>
I think DESTDIR is supposed to be an env var of the make install call, not configure
<ryanf>
at least that's how this script I'm looking at does it
<drbrain>
ryanf: that sounds right
dhsmith has quit [Ping timeout: 264 seconds]
<sdegutis>
phew!
<sdegutis>
i was about to do make install before i read that
<sdegutis>
but i was waiting on the quicksort test (ironic)
<sdegutis>
oh my!
<sdegutis>
ruby 2.1 is 96mb!?
<drbrain>
sdegutis: that includes RDoc
<sdegutis>
ah
<drbrain>
and all the C extensions
<sdegutis>
30mb without share/
<drbrain>
you can trim it down for embedded use, you probably won't need curses, for example
<sdegutis>
good point
dhsmith has joined #ruby-lang
<sdegutis>
thx drbrain, you're a real help
nlv has joined #ruby-lang
<drbrain>
there's a make target for building everything but the documentation
<drbrain>
I don't know what it is offhand
dhsmith_ has quit [Ping timeout: 245 seconds]
joshuawscott has joined #ruby-lang
<sdegutis>
well its already built now
jstemmer has quit [Ping timeout: 264 seconds]
jstemmer has joined #ruby-lang
rwk1 has joined #ruby-lang
nevill has quit [Quit: nevill]
kurko__ has quit [Quit: Computer has gone to sleep.]
<whitequark>
drbrain: ruby for embedded use :/
<whitequark>
://
joshuawscott has quit [Ping timeout: 240 seconds]
sush24 has joined #ruby-lang
<sdegutis>
so, uh, where's the lib? do you just link against lib/libruby-static.a or is there another one?
mistym has quit [Remote host closed the connection]
fuhgeddaboudit has joined #ruby-lang
wmoxam has joined #ruby-lang
<sdegutis>
actually, more pressing question.. ruby-2.1.0/ruby.h exists, but it contains a bunch of #include "ruby/something.h"
<sdegutis>
i must have missed the flag to tell it to fix that
<sdegutis>
all i did was "./configure --enable-load-relative --prefix=/Users/sdegutis/Desktop/built && make install"
<whitequark>
sdegutis: what are you trying to do?
<sdegutis>
build ruby 2.1 so i can embed it in a mac app
<sdegutis>
so i got it so i can #include "ruby-2.1.0/ruby.h" in my program, but inside that file its #including "ruby/whatever.h" too, not realizing where it really is
<sdegutis>
even though i never told it to make it include/ruby-2.1.0/ruby.h, it somehow knew itself, but it didnt know well enough to change its #includes within that file to know the same thing
<whitequark>
why are you building 2.1? that's not released yet
<sdegutis>
oh.
<sdegutis>
i guess i shoudlnt have done it on HEAD
<sdegutis>
i just cloned github/ruby/ruby.git
<sdegutis>
sorry :(
<whitequark>
same for HEAD
* sdegutis
backs up a step
<whitequark>
it's undergoing rather extensive changes in the GC
<whitequark>
you do not want to debug that.
<whitequark>
just build latest 2.0 patchlevel
<sdegutis>
right, doing that now.
<sdegutis>
lookin for sha
<sdegutis>
whitequark: how does one know what the latest patchlevel is?
<sdegutis>
i found ruby_2_0_0 branch/tag, but im sure thats not any patch level
<sdegutis>
oh maybe it is, if its a branch
dhsmith has quit [Remote host closed the connection]
dhsmith has joined #ruby-lang
<sdegutis>
ah, p247, thanks wikipedia :)
dhsmith has quit [Read error: No route to host]
dhsmith has joined #ruby-lang
tdy has quit [Read error: Connection reset by peer]
tdy has joined #ruby-lang
hinbody_ has left #ruby-lang [#ruby-lang]
rwk1 has quit [Remote host closed the connection]
<sdegutis>
ok, rebuilt with 2.0.0
<sdegutis>
same problem, its looking for #include "ruby/subst.h" within "ruby-2.0.0/ruby.h"
<sdegutis>
googling, but if anyone in here knows, i would thank you for mentioning it :)
rwk1 has joined #ruby-lang
Voker57 has quit [Read error: Operation timed out]
<sdegutis>
oooh never mind, im just stupid
<sdegutis>
its really ruby-2.0.0/ruby/ruby.h, so the ruby-2.0.0 should be part of my -I
nlv has quit [Remote host closed the connection]
sascha_d has joined #ruby-lang
<sdegutis>
woot, time for rb_apply()
<sdegutis>
(cuz it crashes when i do it manaully :/)
setmeaway2 has joined #ruby-lang
io_syl has joined #ruby-lang
jonthewayne has quit [Ping timeout: 250 seconds]
iliketurtles has quit [Quit: zzzzz…..]
bradsmith has quit [Remote host closed the connection]
nlv has joined #ruby-lang
mistym has joined #ruby-lang
yatish27 has quit [Remote host closed the connection]
apeiros has quit [Read error: Connection reset by peer]
apeiros has joined #ruby-lang
<sdegutis>
did something change between 1.8.7 and 2.0.0 that would cause rb_funcall2(obj, rb_intern("call"), argsPtr) to suddenly fail?
flip_digits has quit [Remote host closed the connection]
<sdegutis>
the equivalent rb_apply(...) fails too
Voker57 has joined #ruby-lang
bradsmith has joined #ruby-lang
Fraibert has quit []
<sdegutis>
oh, nevermind. i was just passing Qnil in stupidly
<sdegutis>
welp, thats like 3 mistakes in a row
<sdegutis>
thanks everyone for your saintly patience with me tonight
<sdegutis>
shutting up now
bradsmith has quit [Ping timeout: 245 seconds]
joast has joined #ruby-lang
yfeldblum has quit [Ping timeout: 264 seconds]
henrikhodne has quit [Ping timeout: 264 seconds]
<matti>
;]
yatish27 has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
<sdegutis>
thanks guys for the idea of linking to 2.0 instead of 1.8.7
<sdegutis>
this is pretty neat.
dhruvasagar has joined #ruby-lang
joshuawscott has joined #ruby-lang
hahuang65 has quit [Ping timeout: 264 seconds]
joshuawscott has quit [Ping timeout: 245 seconds]
iliketurtles has joined #ruby-lang
yatish27 has quit [Remote host closed the connection]
eoinkelly has quit [Quit: eoinkelly]
apeiros has quit [Ping timeout: 264 seconds]
tomzx_mac has quit [Ping timeout: 264 seconds]
voip_engineer has quit [Read error: Connection reset by peer]
voip_engineer has joined #ruby-lang
hogeo has quit [Read error: Connection reset by peer]
hogeo has joined #ruby-lang
dhsmith has quit [Remote host closed the connection]
bradsmith has joined #ruby-lang
GeissT has joined #ruby-lang
shireesh has joined #ruby-lang
shireesh has quit [Ping timeout: 264 seconds]
dingus_khan has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
dingus_khan has quit [Remote host closed the connection]
eoinkelly has joined #ruby-lang
nevill has joined #ruby-lang
<sdegutis>
is there a way to do rb_protect() but using the current scope?
apeiros has joined #ruby-lang
<sdegutis>
i basically want to catch errors that happen during a rb_apply()
rshetty has joined #ruby-lang
<sdegutis>
the only workaround i can think of is to create a trampoline fn inside ruby, and call that via rb_protect, passing in [proc].concat(args)
shireesh has joined #ruby-lang
v1rr3n has quit [Quit: WeeChat 0.4.1]
joshuawscott has joined #ruby-lang
joshuawscott has quit [Ping timeout: 264 seconds]
sush24 has quit [Quit: This computer has gone to sleep]
cads has joined #ruby-lang
<sdegutis>
that worked, but im not proud of it
sush24 has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 264 seconds]
dhsmith has joined #ruby-lang
fragamus has joined #ruby-lang
iliketurtles has quit [Quit: zzzzz…..]
MartynKeigher is now known as MartynKeigherAWY
bradsmith has quit [Remote host closed the connection]
MartynKeigherAWY is now known as MartynKeigher|AW
dhruvasagar has joined #ruby-lang
solars has joined #ruby-lang
workmad3 has joined #ruby-lang
xuser has joined #ruby-lang
sush24 has quit [Ping timeout: 264 seconds]
firstdayonthejob has joined #ruby-lang
sush24 has joined #ruby-lang
relix has joined #ruby-lang
jonahR has quit [Quit: jonahR]
vlad_starkov has joined #ruby-lang
singpolyma has quit [Ping timeout: 245 seconds]
Senjai has quit [Ping timeout: 245 seconds]
alfreddba has joined #ruby-lang
alfreddba has quit [Max SendQ exceeded]
workmad3 has quit [Ping timeout: 245 seconds]
alfreddba has joined #ruby-lang
alfreddba has quit [Max SendQ exceeded]
alfreddba has joined #ruby-lang
alfreddba has quit [Max SendQ exceeded]
hahuang65 has joined #ruby-lang
alfreddba has joined #ruby-lang
alfreddba has quit [Max SendQ exceeded]
alfreddba has joined #ruby-lang
alfreddba has quit [Max SendQ exceeded]
alfreddba has joined #ruby-lang
alfreddba has quit [Max SendQ exceeded]
alfreddba has joined #ruby-lang
alfreddba has quit [Max SendQ exceeded]
alfreddba has joined #ruby-lang
alfreddba has quit [Max SendQ exceeded]
alfreddba has joined #ruby-lang
alfreddba has quit [Max SendQ exceeded]
vlad_starkov has quit [Remote host closed the connection]
fragamus has quit [Quit: Computer has gone to sleep.]
joshuawscott has joined #ruby-lang
mistym has quit [Remote host closed the connection]
singpolyma has joined #ruby-lang
bradsmith has joined #ruby-lang
joshuawscott has quit [Ping timeout: 245 seconds]
dagobah has joined #ruby-lang
hashkey has quit [Quit: Leaving]
benlovell has joined #ruby-lang
bradsmith has quit [Ping timeout: 245 seconds]
sush24_ has joined #ruby-lang
sush24 has quit [Ping timeout: 245 seconds]
hahuang65 has quit [Ping timeout: 248 seconds]
jbsan has quit [Quit: jbsan]
rshetty has quit [Quit: Sleeping]
mootpointer has quit [Ping timeout: 245 seconds]
io_syl has quit [Quit: io_syl]
bradsmith has joined #ruby-lang
rshetty has joined #ruby-lang
rwk1 has quit [Remote host closed the connection]
mootpointer has joined #ruby-lang
rshetty has quit [Client Quit]
rshetty has joined #ruby-lang
solars has quit [Ping timeout: 264 seconds]
heftig has joined #ruby-lang
rshetty has quit [Ping timeout: 264 seconds]
flip_digits has joined #ruby-lang
freedrull has quit [Ping timeout: 264 seconds]
freedrull has joined #ruby-lang
minivan has quit [Ping timeout: 264 seconds]
flip_digits has quit [Ping timeout: 245 seconds]
sascha_d has quit [Quit: obai]
barttenbrinke has joined #ruby-lang
maxmanders has joined #ruby-lang
mootpointer has quit [Quit: Computer has gone to sleep.]
Guest56659 has quit [Remote host closed the connection]
firstdayonthejob has quit [Quit: WeeChat 0.4.1]
sush24_ has quit [Ping timeout: 264 seconds]
jsullivandigs has joined #ruby-lang
mbj has joined #ruby-lang
hahuang65 has joined #ruby-lang
jsullivandigs has quit [Ping timeout: 245 seconds]
mytrile has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
hahuang65 has quit [Ping timeout: 245 seconds]
<yorickpeterse>
Fear not, I have arrived
<sdegutis>
hi
<sdegutis>
and who are you?
<sdegutis>
also, is there a better way to get a class's name than rb_funcall(klass, rb_intern("name"), 0) ?
mootpointer has joined #ruby-lang
<sdegutis>
followed by StringValueCStr
hahuang65 has joined #ruby-lang
solars has joined #ruby-lang
postmodern has quit [Quit: Leaving]
vlad_starkov has joined #ruby-lang
joshuawscott has joined #ruby-lang
limon7 has quit [Quit: Konversation terminated!]
vlad_starkov has quit [Ping timeout: 264 seconds]
<yorickpeterse>
sdegutis: I am me
mootpointer has quit [Quit: Computer has gone to sleep.]
limon7 has joined #ruby-lang
<sdegutis>
ok
hahuang65 has quit [Ping timeout: 248 seconds]
<yorickpeterse>
and no, not that I know of
<sdegutis>
ok
<sdegutis>
welp,
joshuawscott has quit [Ping timeout: 276 seconds]
<sdegutis>
then i guess all i have left to do is figure out why my rb_define_alloc_func() function is returning something that crashes and stuff
<injekt>
rue: did you find anything?
barttenbrinke has quit [Remote host closed the connection]
judofyr has joined #ruby-lang
marr has joined #ruby-lang
hahuang65 has joined #ruby-lang
minivan has joined #ruby-lang
fosky has quit [Ping timeout: 245 seconds]
ffio has joined #ruby-lang
cads has quit [Quit: Leaving]
cads has joined #ruby-lang
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
cat_martyn has joined #ruby-lang
yatish27 has joined #ruby-lang
hahuang65 has quit [Ping timeout: 264 seconds]
<gnufied>
drbrain: hey, thanks for fixing that thread safety problem while compiling extensions
save has joined #ruby-lang
hahuang65 has joined #ruby-lang
hahuang61 has joined #ruby-lang
setmeaway2 has quit [Read error: Connection reset by peer]
shireesh has quit [Ping timeout: 245 seconds]
elia has joined #ruby-lang
hahuang61 has quit [Client Quit]
tbuehlmann has joined #ruby-lang
hahuang61 has joined #ruby-lang
hahuang65 has quit [Ping timeout: 276 seconds]
hahuang65 has joined #ruby-lang
eoinkelly has quit [Quit: eoinkelly]
ryez has quit [Quit: Page closed]
shireesh has joined #ruby-lang
kstuart has joined #ruby-lang
ledestin has joined #ruby-lang
joshuawscott has joined #ruby-lang
nlv has quit [Remote host closed the connection]
zavier has quit [Quit: WeeChat 0.4.0]
joshuawscott has quit [Ping timeout: 264 seconds]
<sdegutis>
oh is ee why its T_DATA.. cuz it has internal C data.
<andrewvos>
It's not bad judofyr. Kind of nice looking. I do like having the raw power of ruby though.
<andrewvos>
sdegutis: Maybe you should be more positive in your coding? How about "laughterfactory" next time?
<judofyr>
andrewvos: I kinda agree, but it cuts both ways. also: Ansible can run completely over SSH with no other dependencies on the server than bash
<yorickpeterse>
"happyfactory"
<sdegutis>
andrewvos: thats not as funny
<andrewvos>
judofyr: Nothing an scp can't fix :)
<andrewvos>
judofyr: Ruby is pretty much everywhere anyway right?
<judofyr>
toretore: completely depends on the project.
<toretore>
yeah. for small libraries i think it's fine though
tkuchiki has quit [Remote host closed the connection]
<yorickpeterse>
spork, y u preload helpers
<yorickpeterse>
spork plz
<toretore>
with rdoc
<yorickpeterse>
fuckit, co-worker can solve this
<judofyr>
toretore: for "value classes" it's fine (e.g. a Request object is very easy to understand through rdoc). if it's something that's used together with other classes (e.g. a Renderer-class) it's more difficult
<toretore>
well, you could just explain at the top how the class is meant to be used
<judofyr>
yes
<judofyr>
that's my point :)
<toretore>
Renderer.new(view).to_html
<toretore>
ah
<toretore>
right, i said source code :P
mbj has joined #ruby-lang
<judofyr>
toretore: (I was thinking about a more complex renderer though; something that fetches templates from disk, compiles and caches them, supports multiple engines etc.)
<toretore>
that sounds more like middleware to me
thepumpkin has quit [Remote host closed the connection]
<judofyr>
what does that sentence even mean? :)
<yorickpeterse>
clearly what we need to do is write long_natural_method_names_that_read_like_sentences_because_dhh_tells_us_to
<toretore>
hah
<toretore>
what i mean is that sounds like something that does too much
<toretore>
i can easily see 3 or 4 independent tasks there
<judofyr>
toretore: it could be composed of multiple classes, but it is nice having one class that bundles it together.
<toretore>
right
<toretore>
the ware in the middle
<judofyr>
it's those kinda of classes that really need "free text" documentation
<judofyr>
;)
<toretore>
i think. i've never used that word before
<toretore>
here's something that seems to be missing documentation: elasticsearch
<toretore>
i don't understand it
<judofyr>
agreed. it has detailed information about how using specific features.
<judofyr>
but it's difficult to understand how everything fits together
<judofyr>
toretore: what are you having problems with?
<toretore>
exactly
<toretore>
i don't really have problems with mapping and using the indexing api
<toretore>
i just don't understand how it operates beneath that level
<toretore>
shards disappearing etc
<toretore>
and i wish it had an explicit api for reindexing
yatish27 has quit [Remote host closed the connection]
anonymuse has quit [Read error: Connection reset by peer]
anonymuse has joined #ruby-lang
enebo has joined #ruby-lang
scampbell has joined #ruby-lang
<sush24>
possible a bit off topic .. I was checking out https://gist.github.com/jotto/2932998 .. in oAuth2, should I store the first oauth token and refresh whenever needed?
heftig has quit [Read error: Connection reset by peer]
<sush24>
*possibly
heftig has joined #ruby-lang
pipework has quit [Remote host closed the connection]
joshuawscott has joined #ruby-lang
wmoxam has quit [Ping timeout: 264 seconds]
cjs226 has quit [Ping timeout: 264 seconds]
kstuart has quit [Ping timeout: 240 seconds]
MartynKeigher|AW is now known as MartynKeigher
yatish27 has joined #ruby-lang
kstuart has joined #ruby-lang
thisirs has joined #ruby-lang
tomzx_mac has joined #ruby-lang
itcharlie has joined #ruby-lang
imperator has joined #ruby-lang
vlad_starkov has joined #ruby-lang
imperator has quit [Client Quit]
w00x has joined #ruby-lang
imperator has joined #ruby-lang
yatish27 has quit [Remote host closed the connection]
<andrewvos>
I need to have the pygments binary on the command line
<andrewvos>
But this buildpack deletes all build directories
<andrewvos>
Just wondering what would be a nice approach
<andrewvos>
I mean I could just not delete the directory
nathanstitt has joined #ruby-lang
<andrewvos>
But I wanted to make my change quite small, so it could possibly get merged. It probably won't get merged, but I would like the changes to be minimal
glebm has joined #ruby-lang
<andrewvos>
(btw the pygments installation part is quite obviously broken)
<andrewvos>
Hmm does `mv dir/* somewhere` move directories inside dir?
benlovell has quit [Ping timeout: 264 seconds]
io_syl has quit [Quit: io_syl]
<ledestin>
what else would it do?
henrikhodne has joined #ruby-lang
<ledestin>
except those starting with *
<andrewvos>
ledestin: Well I was wondering if it would just move files
<ledestin>
and files of course
hemangpatel has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
hemangpatel has left #ruby-lang [#ruby-lang]
ssb123 has quit [Remote host closed the connection]
mdedetrich has quit [Quit: Computer has gone to sleep.]
siberia has joined #ruby-lang
ssb123 has joined #ruby-lang
siberia has quit [Quit: siberia]
x0f has quit [Ping timeout: 264 seconds]
Uranio has quit [Quit: while you reading this, a kitty dies]
mistym has quit [Remote host closed the connection]
itcharlie has quit [Read error: No route to host]
x0f has joined #ruby-lang
elia has quit [Quit: (IRC Client: textualapp.com)]
heftig has joined #ruby-lang
henrikhodne has quit [Ping timeout: 264 seconds]
skade has quit [Quit: Computer has gone to sleep.]
elia has joined #ruby-lang
wallerdev has joined #ruby-lang
iliketurtles has joined #ruby-lang
iliketurtles has quit [Max SendQ exceeded]
tyman has joined #ruby-lang
iliketurtles has joined #ruby-lang
sdegutis has joined #ruby-lang
sdegutis has quit [Changing host]
sdegutis has joined #ruby-lang
mistym has joined #ruby-lang
jxweng has joined #ruby-lang
ledestin has quit [Quit: ledestin]
solars has quit [Ping timeout: 245 seconds]
<yorickpeterse>
I don't like Mongoid
<yorickpeterse>
It tries so hard to be a relational ORM/DB and fails equally hard at it
<yorickpeterse>
"ZOMGGG DON'T USE RELATIONAL DBs, USE MONGO FOR SPEED!!!!111"
<yorickpeterse>
"BUT LETS USE, YOU KNOW, RELATIONS SO WE CAN JOIN STUFF!"
<yorickpeterse>
Ugh
<sdegutis>
is there a better way to dynamically dispatch methods in a C-created Ruby class than rb_define_method with "method_missing"?
<whitequark>
sdegutis: I don't think so.
<whitequark>
what's the problem with method_missing?
<yorickpeterse>
sdegutis: yes, write Ruby code
* yorickpeterse
runs
<sdegutis>
um, .. i dont remember
* whitequark
sighs
* yorickpeterse
likes slapping people and randomly picks sdegutis to slap
<sdegutis>
k
<yorickpeterse>
That plugin never fails to amaze me
<erikh>
nosql in a nutshell
<yorickpeterse>
erikh: yeah sadly
<erikh>
knowsql
sreffotsirk has joined #ruby-lang
mbull9 has joined #ruby-lang
pskosinski has joined #ruby-lang
dagobah has quit [Remote host closed the connection]
fess has quit [Quit: ..]
northelks has joined #ruby-lang
mbj has joined #ruby-lang
ssb123 has quit [Remote host closed the connection]
iliketurtles has quit [Quit: zzzzz…..]
iliketurtles has joined #ruby-lang
kstuart has quit [Ping timeout: 264 seconds]
LauraE has joined #ruby-lang
pskosinski has quit [Quit: Til rivido Idisti!]
apeiros has quit [Remote host closed the connection]
jsullivandigs has quit [Remote host closed the connection]
jsullivandigs has joined #ruby-lang
digs has joined #ruby-lang
jsullivandigs has quit [Read error: Connection reset by peer]
digs is now known as Guest98173
LauraE has quit [Ping timeout: 246 seconds]
minivan has joined #ruby-lang
mrsolo has joined #ruby-lang
sreffotsirk has quit [Quit: ❤]
ssb123 has joined #ruby-lang
bgant has quit [Quit: Leaving.]
Senjai has joined #ruby-lang
poga has joined #ruby-lang
__butch__ has joined #ruby-lang
cat_martyn has quit []
Guest98173 has quit [Ping timeout: 256 seconds]
jbsan has joined #ruby-lang
LauraE has joined #ruby-lang
thmzlt has joined #ruby-lang
LauraE has left #ruby-lang [#ruby-lang]
sreffotsirk has joined #ruby-lang
bgant has joined #ruby-lang
io_syl has joined #ruby-lang
LanceHaig has quit [Changing host]
LanceHaig has joined #ruby-lang
retro|cz has joined #ruby-lang
Voker57 has joined #ruby-lang
tkuchiki has quit [Remote host closed the connection]
maxmanders has quit [Quit: Computer has gone to sleep.]
kstuart has joined #ruby-lang
justinmcp has quit [Quit: No Ping reply in 180 seconds.]
tkuchiki has quit [Ping timeout: 264 seconds]
skade has joined #ruby-lang
sstrickl has joined #ruby-lang
justinmcp has joined #ruby-lang
sstrickl has quit [Changing host]
sstrickl has joined #ruby-lang
kstuart has quit [Client Quit]
symm- has joined #ruby-lang
kstuart has joined #ruby-lang
sascha_d has quit [Quit: obai]
thisirs has quit [Remote host closed the connection]
hogeo has quit [Remote host closed the connection]
justinmcp has quit [Client Quit]
dingus_khan has joined #ruby-lang
mbull9 has quit [Remote host closed the connection]
justinmcp has joined #ruby-lang
imperator has quit [Quit: Valete!]
solars has joined #ruby-lang
henrikhodne has joined #ruby-lang
justinmcp has quit [Quit: No Ping reply in 180 seconds.]
justinmcp has joined #ruby-lang
pskosinski has joined #ruby-lang
<injekt>
u
pskosinski has quit [Client Quit]
justinmcp has quit [Client Quit]
justinmcp has joined #ruby-lang
sush24 has quit [Ping timeout: 276 seconds]
justinmcp has quit [Client Quit]
nathanstitt has quit [Quit: I growing sleepy]
justinmcp has joined #ruby-lang
Voker57 has quit [Remote host closed the connection]
jbsan has quit [Quit: JB.. OUT!]
justinmcp has quit [Quit: No Ping reply in 180 seconds.]
rickruby has quit [Remote host closed the connection]
justinmcp has joined #ruby-lang
jbsan has joined #ruby-lang
<sdegutis>
is there a way to built ruby so that libruby-static.a isnt so huge (10mb)?
<sdegutis>
also, is it safe to just delete stuff in lib/ruby/2.0.0/ randomly, or are there certain files that will break an embedded ruby interpreter if they're not there?
bradland has joined #ruby-lang
justinmcp has quit [Client Quit]
Voker57 has joined #ruby-lang
justinmcp has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
apeiros has joined #ruby-lang
<whitequark>
sdegutis: 10mb isn't huge
<whitequark>
it's tiny in fact
<whitequark>
well, you can try compiling it with -Os or -Oz
<sdegutis>
this app started as less than 1mb, now embedding ruby its 25mb
<whitequark>
but don't expect the difference to be significant
<sdegutis>
ok then ill focus on removing the libs
<whitequark>
sure, that's why you should embed Lua or other langs which are specifically developed for it
<whitequark>
maybe mruby?
<sdegutis>
yeah maybe ill try mruby
<whitequark>
libs. no, nothing will break, you just won't be able to use these libs.
<whitequark>
all core ruby should be in the .a
<sdegutis>
whitequark: excellent.
<sdegutis>
thanks :)
<lianj>
mruby used to feel like meh
<sdegutis>
lianj: but now?
<lianj>
dunno
<whitequark>
lianj: it's fine for application embedding imo.
<whitequark>
lots of stuff is missing but if you don't run existing code it's ok
<whitequark>
sdegutis: I use i3 and linux
<sdegutis>
k
<whitequark>
don't consider OS X a good OS :)
<sdegutis>
meh subjective
<whitequark>
yup
<lianj>
whitequark: i would like mruby with builtin ffi
<whitequark>
lianj: then add it!
<whitequark>
like, it's not exactly complex
<lianj>
no you do! :P
justinmcp has quit [Quit: No Ping reply in 180 seconds.]
<whitequark>
I don't use mruby
<whitequark>
in fact, these days I just use ocaml :D
justinmcp has joined #ruby-lang
<sdegutis>
so, i basically reinvented half of RubyCocoa, and it just breaks.
<sdegutis>
i thank ARC
workmad3 has joined #ruby-lang
<whitequark>
ha, ARC
<sdegutis>
yes?
<lianj>
whitequark: actually i will give it some hours
netShadow has joined #ruby-lang
tyman has quit [Quit: tyman]
charliesome has joined #ruby-lang
adambeynon has joined #ruby-lang
workmad3 has quit [Ping timeout: 264 seconds]
<sdegutis>
what's x86_64-darwin12.4.0/enc for?
elia has joined #ruby-lang
charliesome has quit [Client Quit]
skade has joined #ruby-lang
charliesome has joined #ruby-lang
skade has quit [Client Quit]
<sdegutis>
yay now my app is only 17mb
Drekonus has joined #ruby-lang
sreffotsirk has quit [Quit: ❤]
dc5ala has joined #ruby-lang
iliketurtles has quit [Quit: zzzzz…..]
postmodern has joined #ruby-lang
saarinen has joined #ruby-lang
<sdegutis>
what's the right way to manage a VALUE that you receive from a ruby extension C function, and pass around within your app, when Ruby no longer knows about it?
tbuehlmann has joined #ruby-lang
LauraE has joined #ruby-lang
skade has joined #ruby-lang
firstdayonthejob has joined #ruby-lang
<drbrain>
sdegutis: each encoding is implemented as a shared library
bradsmith has quit [Remote host closed the connection]
<sdegutis>
drbrain: so deleting those will just break specialized encodings, but ruby files with unspecified encodings will still work?
rickruby has joined #ruby-lang
elia has quit [Ping timeout: 268 seconds]
<sdegutis>
it looks like its still working, but i dont have any encode str in my ruby file
<drbrain>
sdegutis: you can probably delete anything that's not UTF-8, US-ASCII and BINARY (if there is a such a file) if you're not doing any text processing
<sdegutis>
i see
<sdegutis>
thanks :)
<drbrain>
sdegutis: although i'm unsure if you are supposed to also edit the encodings list before patching, I'm not sure if the lookup is done solely on existence of the shared object
<charliesome>
sdegutis: you could use rb_gc_register_address
<sdegutis>
charliesome: is it necessary?
<drbrain>
sdegutis: how is the object in this VALUE created?
<charliesome>
sdegutis: or you could create your own data type with its own allocate/mark/free semantics
<drbrain>
if you Data_Wrap_Struct/ Data_Make_Struct you should set its allocate/mark/free as charliesome said and ruby will GC it when it is no longer referenced
<sdegutis>
drbrain: its so complex right now that im not even sure i know anymore
Senjai has quit [Read error: Operation timed out]
<charliesome>
sdegutis: sec, doing up a code example
<drbrain>
(mark is used for ruby objects the structure references that ruby can't see)
<drbrain>
sdegutis: if it's a String, Array or other built-in type then ruby will just GC it
<drbrain>
charliesome: I think sdegutis is allocating objects in his C extension already
<sdegutis>
so im converting between ObjC and VALUE types, using plain old methods (rb_str_new2() and StringValueCStr() etc)
<sdegutis>
the problem is happening with callbacks
<drbrain>
if you send that to ruby and stop referencing it the GC will clean it up
pskosinski has joined #ruby-lang
<sdegutis>
when i pass a Proc to my C extension, i save it in my program's own memory, but it's already left the Ruby GC by that point
Uranio has joined #ruby-lang
pskosinski has quit [Remote host closed the connection]
<charliesome>
sdegutis: so use rb_gc_register_address with the location where you save the VALUE
<sdegutis>
ive tried calling rb_gc_register_address() on the proc when i receive it and rb_gc_unregister_address() when im done with it, it didnt solve my bug
<charliesome>
did you call it on the VALUE itself, or the address where the VALUE is
<charliesome>
ie. if you have 'VALUE my_value;' you need 'rb_gc_register_address(&my_value);'
<drbrain>
sdegutis: if you pass the proc to your C extension there's a reference on the stack
<sdegutis>
i call it on the address where it is
<drbrain>
so I don't think you need rb_gc_register_address
<sdegutis>
oh right
<drbrain>
sdegutis: what error do you get?
<sdegutis>
drbrain: sometimes -call: happens on the proc, sometimes it happens on a random object in memory (arrays, strings, whatever)
<drbrain>
if you crash ruby (SEGV, bus error, etc) you are probably missing a rb_gc_register_address()
<sdegutis>
even though the callback never changed. it was defined once.
<drbrain>
so memory corruption?
<drbrain>
this could be a rb_gc_register_address() problem or a fault in your extension
<sdegutis>
its almost definitely a fault in my extension
<drbrain>
I have to get on the bus soon, but if you can show source I think charliesome can help you, if he has the time, of course
<sdegutis>
(btw im embedding ruby, so its not really an extension, but it still kinda is)
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
glebm has quit [Quit: Computer has gone to sleep.]
LauraE has quit [Ping timeout: 264 seconds]
<sdegutis>
thanks drbrain cya
<charliesome>
yeah i'd be happy to take a look if you can post a small-ish sample of code
<sdegutis>
charliesome: unpossible, thats my problem
<sdegutis>
charliesome: its so insanely intertwined
<yorickpeterse>
scroll to the bottom for maximum win
<whitequark>
yorickpeterse: so, yeah, positional/keyword distinction stays.
<yorickpeterse>
time to make foundry++ so you can use templates to work around that
<whitequark>
sigh
* yorickpeterse
orders an extra pair of feet to shoot
<tubbo>
fun
sascha_d has joined #ruby-lang
<sdegutis>
charliesome: that seems to fix it!
<charliesome>
sdegutis: cool
elia has quit [Quit: Computer has gone to sleep.]
mbj_ has joined #ruby-lang
Senjai has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
<whitequark>
yorickpeterse: the point being, API design with distinct kwargs/positional args is simply better
mbj has quit [Ping timeout: 256 seconds]
<whitequark>
basically you stash the "main" object on which the method operates in positional args
<whitequark>
and the "parameters" of the action into kwargs
<yorickpeterse>
hm, do I squash bugs or do I for once actually sit down to read through (ruby-)llvm
vlad_starkov has quit [Ping timeout: 245 seconds]
kstuart has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
thepumpkin has joined #ruby-lang
tbuehlmann has joined #ruby-lang
<sdegutis>
i wish ruby would just implement clojure's bindings-destructuring
<sdegutis>
its way simpler and more intuitive and more powerful than ruby's args stuff.
YoungWonder has joined #ruby-lang
<whitequark>
yeah
<whitequark>
I planned to write a patch for something similar
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<whitequark>
but it turned out to be surprisingly hard to add to parse.y
LauraE has joined #ruby-lang
<whitequark>
I know how it can be done, but that's too much work I'm not going to enjoy
<sdegutis>
whitequark: really?
<whitequark>
really what?
<sdegutis>
i dunno
<sdegutis>
brain broke
<sdegutis>
bbl
<whitequark>
I wanted to do {a, b} = foo, which would be equivalent to a = foo.a; b = foo.b
<whitequark>
but that's an incredible PITA to parse with LALR(1)
<sdegutis>
yeah, ruby isnt suited for that kinda thing
<sdegutis>
it would need a syntax thats more compatible with that.. maybe s-expressions
<whitequark>
lolwhat
<whitequark>
it's more than enough to add a keyword. say "let {a,b} = foo"
<whitequark>
that's what I did in Foundyr
<whitequark>
*Foundry
vlad_starkov has joined #ruby-lang
<sdegutis>
im just making fun of how hard it is to add to ruby and how trivial it was to add to clojure
<sdegutis>
:)
<yorickpeterse>
if it would use emacs lisp it would run everywhere
<whitequark>
i think that the cost of language extensibility is too often too high
<sdegutis>
i dunno, i dont mind whatever cost clojure paid for it
<whitequark>
you're paying it as well
<sdegutis>
oh?
bradsmith has quit [Remote host closed the connection]
<whitequark>
since in order to understand a particular piece of code even in simplest terms (eg control flow) you not only have to know clojure, but also whatever extensions someone did to it
<whitequark>
the second problem is that adding (true) language extensibility is more or less a way of saying "I suck at designing this language, please fix my errors or omissins when you encounter them"
<sdegutis>
whitequark: yeah, but in practice, barely anyone makes control-flow language extensions. they're highly discouraged for obvious reasons.
<sdegutis>
the only ones are the ones built in to the stdlib, which amounts to your point #1
<whitequark>
as a result you have incompatible variants of the same thing people want
<whitequark>
so what I think should happen: we should have complete, finished languages which we can freely compose.
<whitequark>
think of it as quasiquotation for languages.
retro|cz has quit [Ping timeout: 264 seconds]
<sdegutis>
whitequark: well in practice i havent seen any issues come from clojure's extensibility, and ive been using it a good 9 months in production
<whitequark>
9 months is so long indeed
<sdegutis>
whitequark: in theory it may sound scary and broken but in practice it works great.
<whitequark>
oh, that's a common fallacy
<sdegutis>
ok then
<sdegutis>
bbl
<whitequark>
95% of the time, all languages work very well
<whitequark>
it's the rest 5% you have to worry about.
<yorickpeterse>
except for PHP
<yorickpeterse>
PHP never works
skade has quit [Quit: Computer has gone to sleep.]
<sdegutis>
a local company i applied for uses a custom in-house framework built in PHP
<sdegutis>
they seemed to know about other languages, but they said it doesnt matter what language you use, just as long as you know how to use it well.
<sdegutis>
i cant agree with them.
<yorickpeterse>
Oh, that's the common way of saying "We're dumb but we're afraid to admit it"
<whitequark>
that's true, kind of
<yorickpeterse>
it falls in the same category as "Foreign keys are bad for performance so fuck database integrity"
glebm has joined #ruby-lang
<whitequark>
I know of a few really good projects in PHP. Roundcube, for example
<whitequark>
but chances that they do *not* know how to use it well.
<yorickpeterse>
The projects differ, I'm specifically against the language
<yorickpeterse>
as in, I hate it with a deep passion partially due to the people I had to work with when using it
dingus_khan has quit [Remote host closed the connection]
<whitequark>
at least Rasmus apologized :D
<yorickpeterse>
It's not even an easy language, it just allows you to shoot yourself in the foot and bleed to death without feeling the pain
<sdegutis>
:)
<whitequark>
the deploys are easy.
bradsmith has joined #ruby-lang
<sdegutis>
but the templating!
<sdegutis>
its so automagic
<whitequark>
they're also broken, but also easy. that is something you should strive for.
* whitequark
hates capistrano with a passion
skade has joined #ruby-lang
<yorickpeterse>
deployments are easy when you use Stupid te^H^H^H^H Apache
<yorickpeterse>
and yes, Capistrano is meh
<tubbo>
here is how i deploy my apps: `git push origin master`
<tubbo>
then travis sends me an email if shit went wrong
<gnufied>
bah
<whitequark>
that still uses capistrano or something underneath.
<gnufied>
and there is some propreitory sugar that deploys it to heroku after travis build?
<yorickpeterse>
tubbo: I'd wish that would work when deploying to multiple instances
<yorickpeterse>
and those instances can come and go at any given time
<whitequark>
well, or a set of post-commit hooks which is even more terrifying
<yorickpeterse>
1. Run deploy 2. Timeout because fuck you b43 3. Try again 4. Time-out because a server got killed, everything rolled back 5. Try a few more times 6. ???? 7. FINALLY
<gnufied>
the author is planning to go passenger route.
<gnufied>
capistrano-pro (paid) and regular capistrano
<yorickpeterse>
uggghhh
<erikh>
haha
<erikh>
really?
<yorickpeterse>
BUY CAPISTRANO ENTERPRISE NOW TO UNLOCK THE PRO FEATURE "DECENT DEPLOYMENTS", ONLY USD 299
<erikh>
ah fuck I really cant watch irc today
skade has quit [Quit: Computer has gone to sleep.]
<yorickpeterse>
CLICK HERE TO DISMISS THIS MESSAGE FOR ONE HOUR BEFORE IT POPS BACK UP WINRAR STYLE
nivanson has quit [Read error: Connection reset by peer]
nivanson has joined #ruby-lang
<yorickpeterse>
that website looks nice though
<yorickpeterse>
at least the logo does
<yorickpeterse>
links are a total pain to read
<gnufied>
erikh: yep. but if he can make some money more power to him.
<yorickpeterse>
wait, people actually still use Sake?
symm- has quit [Ping timeout: 264 seconds]
<whitequark>
Sake?
<yorickpeterse>
lel, "Commercial support" results in a 4040
<sdegutis>
can i just embed it in my app, or do i need to include something to do it?
<whitequark>
it's dual-licensed under Ruby or BSD, I think
<whitequark>
read the license, it's a page long.
<sdegutis>
k
<sdegutis>
reading
jvrmaia has quit [Quit: Leaving]
<yorickpeterse>
interesting enough it's not OSI approved
LauraE has left #ruby-lang [#ruby-lang]
<whitequark>
that's why the dual-licensing
save has quit [Quit: Konversation terminated!]
netShadow has left #ruby-lang [#ruby-lang]
vlad_starkov has joined #ruby-lang
pskosinski_ has joined #ruby-lang
pskosinski_ has quit [Client Quit]
charliesome has joined #ruby-lang
pothibo has quit [Quit: pothibo]
vlad_starkov has quit [Ping timeout: 245 seconds]
havenwood has quit [Read error: Connection reset by peer]
havenwood has joined #ruby-lang
MaddinXx has quit [Remote host closed the connection]
Drekonus has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<charliesome>
whitequark: lol Digest::HMAC
workmad3 has quit [Ping timeout: 256 seconds]
<yorickpeterse>
whitequark: oi, is using `throw` for flow control in a recursive method an evil idea? In this case I want to use it to signal the caller that it should not process any other children of the current node
<yorickpeterse>
the alternative is a blacklist but that doesn't really work for conditional aborts
nathanstitt has quit [Quit: I growing sleepy]
<rue>
Throw is flow control
<yorickpeterse>
(inb4 abortion joke)
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<whitequark>
yorickpeterse: no it's ok
<yorickpeterse>
wohoo
<yorickpeterse>
ok I probably should write `throw(:abort_children)`
loincloth has quit [Remote host closed the connection]
anonymuse has quit [Remote host closed the connection]
nathanstitt has joined #ruby-lang
anonymuse has joined #ruby-lang
nathanstitt has quit [Client Quit]
Nisstyre has joined #ruby-lang
charliesome has joined #ruby-lang
nathanstitt has joined #ruby-lang
charliesome has quit [Client Quit]
bradsmit_ has quit [Remote host closed the connection]
ruby-lang645 has joined #ruby-lang
toretore has quit [Quit: Leaving]
JimmyAtCMU has joined #ruby-lang
tylersmith has quit [Remote host closed the connection]
pbjorklund has quit [Ping timeout: 276 seconds]
havenwood has quit [Remote host closed the connection]
ruby-lang645 has quit [Ping timeout: 250 seconds]
joshuawscott has quit [Quit: Leaving.]
nathanstitt has quit [Quit: I growing sleepy]
ssb123 has quit [Remote host closed the connection]
zwerg has quit [Remote host closed the connection]
charliesome has joined #ruby-lang
<freedrull>
has anyone tried to make CSV::Table implement uniq, by perhaps including Comparable in CSV::Row and implementing eql? there or something...
<sdegutis>
whitequark: are you open to having your bot log other channels too?
<whitequark>
yes
<sdegutis>
whitequark: can you send him to #zephyros?
<whitequark>
done
_whitelogger has joined #ruby-lang
javajax has quit [Quit: Leaving.]
<sdegutis>
thanks whitequark
sdegutis has quit [Remote host closed the connection]
ilyam has joined #ruby-lang
JimmyAtCMU has quit [Remote host closed the connection]
elia has quit [Read error: Connection reset by peer]
elia has joined #ruby-lang
__butch__ has quit [Quit: Leaving.]
kpads has joined #ruby-lang
elia has quit [Read error: Connection reset by peer]
tomzx_mac has joined #ruby-lang
tonni_ has quit [Remote host closed the connection]
geopet has quit [Quit: geopet]
tonni has joined #ruby-lang
elia has joined #ruby-lang
joshuawscott has joined #ruby-lang
glebm has quit [Ping timeout: 256 seconds]
anonymuse has quit [Remote host closed the connection]
elia has quit [Quit: (IRC Client: textualapp.com)]
bradland has quit [Ping timeout: 256 seconds]
Voker57 has quit [Ping timeout: 264 seconds]
bradsmith has joined #ruby-lang
tylersmith has joined #ruby-lang
bradsmith has quit [Ping timeout: 268 seconds]
mbj has quit [Ping timeout: 260 seconds]
tylersmith has quit [Ping timeout: 260 seconds]
benanne has quit [Quit: kbai]
Voker57 has joined #ruby-lang
pcfreak30 has joined #ruby-lang
cads has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 269 seconds]
<pcfreak30>
Hello, I am trying to learn ruby's concepts and there is something I dont get. I am seeing methods calls like "function :a => :b, c=> d" or such and cant figure out how that works. Thanks
<mistym>
pcfreak30: Before Ruby 2.0, that's passing a hash to the method. So your method would be like: def func(hsh); return hsh[:a] == :b; end
<mistym>
Ruby 2.0 introduced support for keyword arguments that automatically unpacks that into variables for you: def func(a: :default, b: :default); return a == :b; end
<mistym>
pcfreak30: The ability to pass a hash without enclosing braces was a bit of syntactic sugar in older versions. `function :a => :b, :c => :d` is identical to `function({:a => :b, :c => :d})` or `hsh = {:a => :b, :c => :d}; function(hsh)`
<pcfreak30>
mistym: would you be able to give a pastie example as its hard to see in irc :S
<mistym>
pcfreak30: Sure
<pcfreak30>
I am interested in ruby a lot, I come from PHP, JAVA, C#, etc. Just lack of time to start any project :)
<pcfreak30>
Thanks mistym . Now I would like to know when giving a hash is preferred over a bunch of arguments. As from my background thats just passing an array to everything
<pcfreak30>
And does it convert a hash to a list of arguments automatically if something based on the last example?
<freedrull>
are openstructs slow >_>
pjeide has joined #ruby-lang
<mistym>
pcfreak30: It does convert a hash to a set of named arguments in Ruby 2.0, if declared that way.
<mistym>
A hash is preferred when it helps clarity.
marr has quit [Ping timeout: 264 seconds]
henrikhodne has quit [Ping timeout: 256 seconds]
<mistym>
e.g. function('foo','bar','baz',true) # It's not really clear just from reading this used what it does
<pcfreak30>
ah. Just ued to c style too much :P
<pcfreak30>
used
<mistym>
Whereas function('foo', with_foo: obj, dangerous_option_dont_use: true) is a lot more legible to someone not overly familiar with function()
flip_dig_ has joined #ruby-lang
flip_digits has quit [Read error: Connection reset by peer]
<pcfreak30>
So is it more common to use () with methods or not
<pcfreak30>
As it seems ruby ripped a good bit from perl
<pcfreak30>
with this if not that
<mistym>
Whether you use parens or not is stylistic preference, I guess. Some people always use parens, some use them when necessary for clarity and omit them otherwise
bradland has joined #ruby-lang
<mistym>
Or for method chaining, because of course you can't foo 'bar' .baz, whereas you can foo('bar').baz
<pcfreak30>
eh, just basing off the ruby code ive seen on github and trying to figure things out
<erikh>
perl requires parens for a lot more
<Nilium>
Do what you think is readable and sane.
<pcfreak30>
and i forgot. whats the ! and ? on end of methods
<Nilium>
Part of the method name.
<pcfreak30>
know. but read its a symbolic meaning
<mistym>
People typically name methods with ! for "dangerous" stuff, like stuff that mutates the object (array.delete!('foo'), which deletes values in the original array rather than return a copy)
flip_dig_ has quit [Remote host closed the connection]
<whitequark>
no, not really
<mistym>
? is for interrogatory methods that return a bool. Like array.include? 'foo'
<Nilium>
! is usually meant to indicate that something modifies self (though this is inconsistent), ? is like querying.
<whitequark>
a method! should exist if 1) method without bang exists, 2) it's "dangerous"
<whitequark>
for various values of dangerous. usually, yes, mutation
flip_digits has joined #ruby-lang
<whitequark>
could also be bypassing safety checks or such
<pcfreak30>
Thanks. Just need to understand ruby classes/inheritance and modules a bit more on google.