<riceandbeans>
like config_option = true, config_option.value = 'foo' ?
<apeiros>
like show_foo_part = true/false
<smathy>
riceandbeans, the former.
<apeiros>
alternatively what baweaver showed - set it to nil if it should not be shown, to any non-nil/false value which you can use in the content part too if it should be shown.
<smathy>
riceandbeans, then just `if your_var`
marr has quit [Ping timeout: 246 seconds]
lemur has quit [Ping timeout: 248 seconds]
uglybandersnatch has joined #ruby
<riceandbeans>
ok, I can accept that
<riceandbeans>
nil vs non nil
frozen3 has quit [Read error: Connection reset by peer]
<ruby[bot]>
riceandbeans: Please use your local irb or pry (see ?pry) to experiment, ruboto's eval functionality is for demonstration purposes only.
<riceandbeans>
...ok...I think I'll be good then, just worried about edge cases
<Ox0dea>
First day with Ruby, eh?
<apeiros>
and - surprise - only nil.nil? is true. and only nil/false won't branch into `if foo`
<riceandbeans>
not exactly
<smathy>
riceandbeans, I wouldn't use .nil? - just test the var. false.nil? is false, and the last thing you want is for `show_stuff = false` to SHOW the view.
<riceandbeans>
:\ yeah
<riceandbeans>
it doesn't help that it's for a giant config file so spotting an error is a needle in a hay stack
<riceandbeans>
I need to get it right
madgen has quit [Ping timeout: 264 seconds]
<riceandbeans>
anyway, bbl
<apeiros>
even worse if you use implicit meaning
<riceandbeans>
thanks
<apeiros>
like whether the variable exists or not…
wilbert has quit [Ping timeout: 252 seconds]
goglosh has quit [Ping timeout: 268 seconds]
Inside has quit [Ping timeout: 268 seconds]
rkazak has joined #ruby
benlieb has joined #ruby
wilbert has joined #ruby
rbennacer has joined #ruby
Rutix has quit [Ping timeout: 264 seconds]
LoneHermit has quit [Ping timeout: 250 seconds]
hiyosi has joined #ruby
frozen3 has joined #ruby
Ropeney has joined #ruby
tubuliferous_ has joined #ruby
Rutix has joined #ruby
Rutix has quit [Changing host]
Rutix has joined #ruby
jackjackdripper has quit [Read error: Connection reset by peer]
jackjackdripper has joined #ruby
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
roshanavand has quit [Quit: This computer has gone to sleep]
abyx has quit [Quit: This computer has gone to sleep]
edwinvdgraaf has joined #ruby
kies has joined #ruby
zzz has quit [Remote host closed the connection]
mikecmpbll has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jackjackdripper has quit [Quit: Leaving.]
radens has joined #ruby
radens has left #ruby ["WeeChat 1.3"]
uglybandersnatch has quit [Ping timeout: 244 seconds]
Aviio has quit [Remote host closed the connection]
jackjackdripper has joined #ruby
ruby-lang326 has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
babblebre has joined #ruby
mistermo_ has joined #ruby
blackmesa has quit [Quit: WeeChat 1.4]
edwinvdgraaf has quit [Ping timeout: 250 seconds]
<ruby-lang326>
I am creating a poker simulator with Ruby and it contains a module Ranking that checks an array of Cards and determines what combination you might have.
<ruby-lang326>
My question is a module the right approach? I was wondering if I should make that a class instead. Also I am not sure how to start with testing a module.
abyx has joined #ruby
abyx has quit [Client Quit]
<RickHull>
modules are the easiest to test
<RickHull>
i start with them first
mistermocha has quit [Ping timeout: 246 seconds]
<RickHull>
module methods (at the class layer) have no private state
<RickHull>
so output generally just depends on input
<RickHull>
aka "static" methods
<Ox0dea>
ruby-lang326: Why not a #value method on a Hand class?
<RickHull>
generally you can only go so far with a bare module, and you want to add state. then just call it a class, def initialize, and figure out what you need for private state
rbennacer has quit [Remote host closed the connection]
kies has quit [Ping timeout: 248 seconds]
mistermo_ has quit [Ping timeout: 248 seconds]
ramfjord has joined #ruby
jenrzzz has joined #ruby
rubie has quit [Remote host closed the connection]
jdawgaz has joined #ruby
DTZUZU has joined #ruby
rubie has joined #ruby
lxsameer has quit [Quit: WeeChat 1.4]
pawnbox has quit [Ping timeout: 240 seconds]
rubie has quit [Ping timeout: 252 seconds]
bronson has quit [Remote host closed the connection]
ekinmur has joined #ruby
blackgoat has quit [Ping timeout: 276 seconds]
ruby-lang326 has quit [Ping timeout: 250 seconds]
workmad3 has quit [Ping timeout: 264 seconds]
skade has joined #ruby
ramfjord has quit [Ping timeout: 252 seconds]
ramfjord has joined #ruby
bhaak has quit [Ping timeout: 252 seconds]
jenrzzz has quit [Ping timeout: 248 seconds]
n008f4g_ has quit [Ping timeout: 246 seconds]
maletor has quit [Quit: Computer has gone to sleep.]
xlegoman has quit [Quit: xlegoman]
solocshaw1 has joined #ruby
solocshaw has quit [Read error: Connection reset by peer]
solocshaw1 is now known as solocshaw
maletor has joined #ruby
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bkxd has joined #ruby
sarbs has quit [Ping timeout: 250 seconds]
sarbs has joined #ruby
shazaum_ has joined #ruby
jdawgaz has joined #ruby
freerobby has quit [Quit: Leaving.]
jdawgaz has quit [Client Quit]
sneakerhax has quit [Ping timeout: 276 seconds]
Guest69884 has quit [Ping timeout: 250 seconds]
bkxd has quit [Ping timeout: 276 seconds]
C0deMaver1ck has joined #ruby
C0deMaver1ck is now known as Guest70829
skade has quit [Quit: Computer has gone to sleep.]
skade has joined #ruby
skade has quit [Client Quit]
AustinMatherne has joined #ruby
wilbert has quit [Ping timeout: 252 seconds]
amclain has quit [Quit: Leaving]
frozen3 has quit [Read error: Connection reset by peer]
FooMunki has quit [Quit: FooMunki]
stunder has joined #ruby
FooMunki has joined #ruby
rolha_ has joined #ruby
rolha has quit [Ping timeout: 276 seconds]
lyoshajapan has joined #ruby
ur5us has quit [Remote host closed the connection]
frozen3 has joined #ruby
goglosh has joined #ruby
itaipu has joined #ruby
ur5us has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
ur5us has quit [Remote host closed the connection]
<goglosh>
what was the name that replaced Config::CONFIG?
<goglosh>
oh yes RbConfig
blackgoat has joined #ruby
freerobby has joined #ruby
andywojo has quit [Ping timeout: 240 seconds]
FooMunki has quit [Quit: FooMunki]
<darix>
goglosh: that's like *years* ago :p
<goglosh>
yeah but I'm reading a book that says "look into Config::CONFIG"
stantona has quit [Ping timeout: 248 seconds]
<goglosh>
maybe I should read something more modern? :9
<darix>
goglosh: what book are you reading? maybe there is an updated version of it
blackgoat has quit [Client Quit]
<goglosh>
the well grounded rubyist
<havenwood>
goglosh: the second edition covers Ruby 2
frem has quit [Quit: Connection closed for inactivity]
baweaver has quit [Remote host closed the connection]
andywojo has joined #ruby
djbkd has joined #ruby
bronson has joined #ruby
GodFather has quit [Ping timeout: 244 seconds]
wilbert has joined #ruby
stunder has quit [Ping timeout: 260 seconds]
arescorpio has joined #ruby
ur5us has joined #ruby
bronson has quit [Ping timeout: 252 seconds]
sarbs has quit [Ping timeout: 250 seconds]
sorbo_ has joined #ruby
Aviio has joined #ruby
vikaton has quit [Quit: Connection closed for inactivity]
ramfjord has quit [Ping timeout: 248 seconds]
Aswebb_ has joined #ruby
shazaum_ has quit [Quit: Leaving]
leon_e has joined #ruby
hahuang61 has quit [Ping timeout: 248 seconds]
sarbs has joined #ruby
leon_e has quit [Client Quit]
sudoubuntu has joined #ruby
moeabdol has joined #ruby
leon_e has joined #ruby
Aswebb_ has quit [Ping timeout: 260 seconds]
sorbo_ has quit [Remote host closed the connection]
benlovell has joined #ruby
saneax is now known as saneax_AFK
ur5us has quit [Ping timeout: 248 seconds]
Xeago has joined #ruby
sarbs has quit [Ping timeout: 244 seconds]
benlovell has quit [Ping timeout: 264 seconds]
frozen3 has quit [Read error: Connection reset by peer]
emmanuel_erc has joined #ruby
emmanuel_erc has left #ruby ["ERC (IRC client for Emacs 24.5.1)"]
Xeago has quit [Ping timeout: 244 seconds]
rubie has joined #ruby
bedouin_ has quit [Ping timeout: 264 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
ur5us has joined #ruby
bedouin_ has joined #ruby
bkxd has joined #ruby
maletor has joined #ruby
sarbs has joined #ruby
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jackjackdripper has joined #ruby
bkxd has quit [Ping timeout: 264 seconds]
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
mistermocha has joined #ruby
mistermocha has quit [Remote host closed the connection]
mistermocha has joined #ruby
sarbs has quit [Ping timeout: 244 seconds]
sudoubuntu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
frozen3 has joined #ruby
yqt has quit [Ping timeout: 276 seconds]
sarbs has joined #ruby
abyx has joined #ruby
jdawgaz has joined #ruby
stantona has joined #ruby
diegoaguilar has quit [Remote host closed the connection]
jdawgaz has quit [Client Quit]
abyx has quit [Client Quit]
jdawgaz has joined #ruby
jdawgaz has quit [Client Quit]
rmulliga` has joined #ruby
IrishGringo has joined #ruby
jt__ has joined #ruby
G has joined #ruby
symm- has quit [Ping timeout: 240 seconds]
kies has joined #ruby
diegoaguilar has joined #ruby
Rixius|Alt has quit [Ping timeout: 264 seconds]
yfeldblum has quit [Remote host closed the connection]
Rixius has joined #ruby
bronson has joined #ruby
moeabdol1 has joined #ruby
ur5us has quit [Remote host closed the connection]
sarbs has quit [Ping timeout: 276 seconds]
bronson has quit [Remote host closed the connection]
Dimik has quit [Ping timeout: 244 seconds]
mistermocha has quit [Remote host closed the connection]
mistermocha has joined #ruby
ur5us has joined #ruby
yfeldblum has joined #ruby
moeabdol has quit [Ping timeout: 260 seconds]
jdawgaz has joined #ruby
sorbo_ has joined #ruby
ekinmur has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rubie has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 250 seconds]
G has quit [Quit: leaving]
Suntzu has quit [Read error: Connection reset by peer]
sudoubuntu has joined #ruby
mistermocha has quit [Ping timeout: 264 seconds]
jdawgaz has quit [Client Quit]
sorbo_ has quit [Remote host closed the connection]
jdawgaz has joined #ruby
sp4rrow has joined #ruby
shadoi has quit [Quit: Leaving.]
jdawgaz has quit [Client Quit]
Spami_ has quit [Quit: This computer has gone to sleep]
mostlybadfly has joined #ruby
jt__ has quit [Remote host closed the connection]
hiyosi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Chagel has joined #ruby
jdawgaz has joined #ruby
sudoubuntu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
hahuang61 has joined #ruby
tref has joined #ruby
kam270 has quit [Ping timeout: 244 seconds]
jkahn has quit [Remote host closed the connection]
statelesscode has joined #ruby
<tref>
hey guys I’m looking for the best resource for learning basic algorithms in either ruby or JS. Preferably something at the beginner level with examples of real world application on stuff like: [Hash tables, Linked lists, Breadth-first search, depth-first search, Quicksort, merge sort, Binary search, 2D arrays, Dynamic arrays, Binary search trees, Dynamic programming, Big-O analysis]
<benzrf>
tref: this is not stuff that has real world application if you'rew riting ruby
<benzrf>
*writing
<benzrf>
tref: most of this stuff is only things that get implemented in C
<benzrf>
well, maybe not big-o
<Ox0dea>
And search.
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<tref>
benzrf this because of the higher-level implementation of Ruby?
hahuang61 has quit [Ping timeout: 260 seconds]
<tref>
I’m in the process of interviewing and it seems to be a pretty common question that comes up
<benzrf>
that's kind of silly :(
<tref>
benzrf: tell me about it
<tref>
its a torrent of problems about shit I’ve never used in practice
<Ox0dea>
tref: But it's the same logic that makes standardized testing a reasonable thing to do.
<tref>
Ox0dea: I dont think the game questions are bad
<tref>
I just dont like how I have to explain them verbally
sneakerhax has joined #ruby
sp4rrow has quit [Quit: Textual]
<tref>
Ox0dea: I think the best way to screen a candidate is to do the same exact thing you do at work. Give them a task and see how well they do it
<Radar>
+1
<Ox0dea>
tref: That's far too sensible.
<tref>
The last time they asked me about checkers I wanted to ask the interviewer at which point his fortune 500 payroll company started building games?
<tref>
I thought I was interviewing for application development
hxegon has joined #ruby
z3uS has quit [Ping timeout: 248 seconds]
matp has quit [Excess Flood]
matp has joined #ruby
Rasi has quit [Ping timeout: 248 seconds]
frozen3 has quit [Read error: Connection reset by peer]
slackR has quit [Ping timeout: 248 seconds]
<tref>
That’s like interviewing a Chef with questions about farming
leon_ee has joined #ruby
noService has quit [Ping timeout: 246 seconds]
jinie has quit [Ping timeout: 248 seconds]
leon_e has quit [Ping timeout: 268 seconds]
<Ox0dea>
tref: Was that a Mitch Hedberg reference?
<tref>
yes sir!
Rasi has joined #ruby
jinie has joined #ruby
<Ox0dea>
<3
<tref>
Ox0dea: wish that guy was still around. Such a shame :/
<Ox0dea>
He was pretty great.
braincrash has quit [Quit: bye bye]
z3uS has joined #ruby
<tref>
indeed
slackR has joined #ruby
baweaver has joined #ruby
abyx has joined #ruby
zast has joined #ruby
frozen3 has joined #ruby
Cohedrin has joined #ruby
Suntzu has joined #ruby
<Ox0dea>
tref: Really, though, it's more like expecting a chef to know how to prepare everything from scratch.
<Ox0dea>
Really good chefs even pride themselves on being able to do so.
<smathy>
tref, those sorts of questions are a very effective way of filtering out job opportunities that will be a nightmare.
<tref>
Ox0dea: what are you equating to ‘scratch’
Cohedrin_ has quit [Ping timeout: 252 seconds]
sarbs has joined #ruby
<Ox0dea>
tref: Well, raw ingredients, I suppose.
<Ox0dea>
Probably don't look too far into the analogy.
<tref>
Ox0dea: haha, noted.
G has joined #ruby
jt__ has joined #ruby
ruby-lang236 has joined #ruby
rubie has joined #ruby
freerobby has quit [Quit: Leaving.]
braincrash has joined #ruby
ruby-lang236 has quit [Quit: Page closed]
aeterne has quit [Read error: Connection reset by peer]
darkf_ has joined #ruby
sgambino has joined #ruby
baweaver has quit [Quit: -a- IRC for Android 2.1.31]
j0bk_ has joined #ruby
sorbo_ has joined #ruby
mrfooo_ has joined #ruby
BoxDevelopment_ has joined #ruby
jhill_ has joined #ruby
cbetta_ has joined #ruby
baweaver has joined #ruby
rgs_ has joined #ruby
Mr_Pancake- has joined #ruby
Armand has joined #ruby
bjmllr has joined #ruby
aspiers_ has joined #ruby
Armand is now known as Guest47401
joeyjones_ has joined #ruby
c355e3b_ has joined #ruby
TomyLobo has quit [Disconnected by services]
TomyLobo has joined #ruby
troter________ has joined #ruby
rfv_ has joined #ruby
pfg__ has joined #ruby
nuck has joined #ruby
Lloyd__ has joined #ruby
tekmaster has joined #ruby
deimos__ has joined #ruby
Madplatypus_ has joined #ruby
nuck is now known as Guest78515
thomasfedb_ has joined #ruby
gsingh93- has joined #ruby
UKn0Meh has joined #ruby
Blue_Ice_ has joined #ruby
awk has joined #ruby
iNeedHelp has joined #ruby
shwouchkster_ has joined #ruby
Lorn_ has joined #ruby
awk is now known as Guest55473
artmann_ has joined #ruby
Guest12896__ has joined #ruby
j2k_ has joined #ruby
abyx has quit [Quit: This computer has gone to sleep]
bestie_ has joined #ruby
bttf_ has joined #ruby
bihi_ has joined #ruby
x77686d_ has joined #ruby
kireevco_ has joined #ruby
shelling___ has joined #ruby
wreet has joined #ruby
wreet has left #ruby [#ruby]
majuscul1 has joined #ruby
jmcc________ has joined #ruby
abhishek_ has joined #ruby
swills_ has joined #ruby
barajasfab has quit [Quit: Leaving]
Eleeleth_ has joined #ruby
svkurowski_ has joined #ruby
DiabolikFreenode has joined #ruby
abhishek_ is now known as Guest84401
j0bk has quit [Ping timeout: 246 seconds]
amitchellbullard has quit [Ping timeout: 246 seconds]
jhill has quit [Ping timeout: 246 seconds]
joeyjones has quit [Ping timeout: 246 seconds]
acalewin has quit [Ping timeout: 246 seconds]
Apocalypse has quit [Ping timeout: 246 seconds]
dling` has quit [Ping timeout: 246 seconds]
aspiers has quit [Ping timeout: 246 seconds]
BoxDevelopment has quit [Ping timeout: 246 seconds]
mrfooo has quit [Ping timeout: 246 seconds]
joeyjones_ is now known as joeyjones
Guest47401 is now known as Apocalypse
Mr_Pancake has quit [Ping timeout: 246 seconds]
HashNuke has quit [Ping timeout: 246 seconds]
Lloyd has quit [Ping timeout: 246 seconds]
rfv has quit [Ping timeout: 246 seconds]
darkf has quit [Ping timeout: 246 seconds]
bjmllr_ has quit [Ping timeout: 246 seconds]
cbetta has quit [Ping timeout: 246 seconds]
ElderFain has quit [Ping timeout: 246 seconds]
EvilJStoker has quit [Ping timeout: 246 seconds]
rgs has quit [Ping timeout: 246 seconds]
pfg has quit [Ping timeout: 246 seconds]
c355e3b has quit [Ping timeout: 246 seconds]
kpwarr has quit [Ping timeout: 246 seconds]
Lorn has quit [Ping timeout: 246 seconds]
thomasfedb has quit [Ping timeout: 246 seconds]
shevy has quit [Ping timeout: 246 seconds]
russt has quit [Ping timeout: 246 seconds]
nugit has quit [Ping timeout: 246 seconds]
tekacs has quit [Ping timeout: 246 seconds]
bihi has quit [Ping timeout: 246 seconds]
troter_______ has quit [Ping timeout: 246 seconds]
Guest67267 has quit [Ping timeout: 246 seconds]
deimos_ has quit [Ping timeout: 246 seconds]
Diabolik has quit [Ping timeout: 246 seconds]
UKn0Me has quit [Ping timeout: 246 seconds]
hplar_ has quit [Ping timeout: 246 seconds]
bttf has quit [Ping timeout: 246 seconds]
shelling__ has quit [Ping timeout: 246 seconds]
Madplatypus has quit [Ping timeout: 246 seconds]
JoL1hAHN has quit [Ping timeout: 246 seconds]
TheCubeLord has quit [Ping timeout: 246 seconds]
kpwarr has joined #ruby
gsingh93 has quit [Ping timeout: 246 seconds]
crayfishx has quit [Ping timeout: 246 seconds]
kalz has quit [Ping timeout: 246 seconds]
Guest12896_ has quit [Ping timeout: 246 seconds]
NuckingFuts has quit [Ping timeout: 246 seconds]
Blue_Ice has quit [Ping timeout: 246 seconds]
Guest8960 has quit [Ping timeout: 246 seconds]
dellavg has quit [Ping timeout: 246 seconds]
Kilo`byte has quit [Ping timeout: 246 seconds]
nyandoge has quit [Ping timeout: 246 seconds]
M-Kodo has quit [Ping timeout: 246 seconds]
Eleeleth has quit [Ping timeout: 246 seconds]
Flipez has quit [Ping timeout: 246 seconds]
jwang has quit [Ping timeout: 246 seconds]
cjk101010 has quit [Ping timeout: 246 seconds]
Mr_Pancake- is now known as Mr_Pancake
tekmaster is now known as tekacs
gsingh93- is now known as gsingh93
bihi_ is now known as bihi
kireevco has quit [Ping timeout: 246 seconds]
incomprehensibly has quit [Ping timeout: 246 seconds]
shwouchkster has quit [Ping timeout: 246 seconds]
vqrs has quit [Ping timeout: 246 seconds]
UserInNeed has quit [Ping timeout: 246 seconds]
jmcc_______ has quit [Ping timeout: 246 seconds]
svkurowski has quit [Ping timeout: 246 seconds]
j2k has quit [Ping timeout: 246 seconds]
RealMarc has quit [Ping timeout: 246 seconds]
trajing has quit [Ping timeout: 246 seconds]
bestie has quit [Ping timeout: 246 seconds]
alxndr has quit [Ping timeout: 246 seconds]
abhishek has quit [Ping timeout: 246 seconds]
dukedave has quit [Ping timeout: 246 seconds]
Antiarc_ has joined #ruby
mrfooo_ is now known as mrfooo
Jamo_ has joined #ruby
kpwarr_ has joined #ruby
raenk has joined #ruby
swills has quit [Ping timeout: 246 seconds]
x77686d has quit [Ping timeout: 246 seconds]
majuscule has quit [Ping timeout: 246 seconds]
artmann has quit [Ping timeout: 246 seconds]
andersh has quit [Ping timeout: 246 seconds]
Elysia has quit [Ping timeout: 246 seconds]
charles81 has quit [Ping timeout: 246 seconds]
beagles has quit [Ping timeout: 246 seconds]
moredhel has quit [Ping timeout: 246 seconds]
Antiarc has quit [Ping timeout: 246 seconds]
Jamo has quit [Ping timeout: 246 seconds]
nitrix has quit [Ping timeout: 246 seconds]
borkdude has quit [Ping timeout: 246 seconds]
Cyrus has quit [Ping timeout: 246 seconds]
atom3 has quit [Ping timeout: 246 seconds]
kpwarr has quit [Ping timeout: 246 seconds]
gremax has quit [Ping timeout: 246 seconds]
podman has quit [Ping timeout: 246 seconds]
RealMarc has joined #ruby
Mekkis has quit [Ping timeout: 246 seconds]
raenk_ has quit [Ping timeout: 246 seconds]
Luna_Moonfang has quit [Ping timeout: 246 seconds]
x77686d_ is now known as x77686d
atom3 has joined #ruby
Flipez has joined #ruby
bestie_ is now known as bestie
dling` has joined #ruby
jhill_ is now known as jhill
Lloyd__ is now known as Lloyd
ElderFain has joined #ruby
jwang has joined #ruby
hxegon has quit [Ping timeout: 246 seconds]
bougyman has quit [Ping timeout: 246 seconds]
trajing has joined #ruby
russt has joined #ruby
dellavg has joined #ruby
cbetta_ is now known as cbetta
bougyman has joined #ruby
shelling___ is now known as shelling__
b3nt_pin has joined #ruby
cjk101010 has joined #ruby
b3nt_pin is now known as Guest40396
moredhel has joined #ruby
glacius has quit [Read error: Connection reset by peer]
M-Kodo has joined #ruby
TheCubeLord has joined #ruby
hplar_ has joined #ruby
Kilo`byte has joined #ruby
glacius has joined #ruby
hxegon has joined #ruby
nugit has joined #ruby
kalz has joined #ruby
Eleeleth_ is now known as Eleeleth
rfv_ is now known as rfv
c355e3b_ is now known as c355e3b
EvilJStoker has joined #ruby
Luna_Moonfang has joined #ruby
Mekkis has joined #ruby
Cyrus has joined #ruby
JoL1hAHN has joined #ruby
vqrs has joined #ruby
pfg__ is now known as pfg
Cyrus is now known as Guest120
Madplatypus_ is now known as Madplatypus
shwouchkster_ is now known as shwouchkster
shevy has joined #ruby
blackgoat has quit [Ping timeout: 244 seconds]
bronson has joined #ruby
borkdude has joined #ruby
gix has quit [Ping timeout: 240 seconds]
uglybandersnatch has joined #ruby
incomprehensibly has joined #ruby
nitrix has joined #ruby
dukedave has joined #ruby
alxndr has joined #ruby
babblebre has quit [Quit: Connection closed for inactivity]
amitchellbullard has joined #ruby
nyandoge has joined #ruby
bkxd has joined #ruby
charles81 has joined #ruby
HashNuke has joined #ruby
kireevco_ is now known as kireevco
bttf_ is now known as bttf
acalewin has joined #ruby
podman has joined #ruby
DTZUZU has quit [Ping timeout: 276 seconds]
crayfishx has joined #ruby
skydiver has joined #ruby
gix has joined #ruby
andersh has joined #ruby
sudoubuntu has joined #ruby
gremax has joined #ruby
uglybandersnatch has quit [Ping timeout: 246 seconds]
bronson has quit [Ping timeout: 252 seconds]
LoneHermit has joined #ruby
bkxd has quit [Ping timeout: 276 seconds]
benlovell has joined #ruby
_blizzy_ has quit [Ping timeout: 248 seconds]
drewo has joined #ruby
LoneHermit has quit [Ping timeout: 276 seconds]
benlovell has quit [Ping timeout: 248 seconds]
hanmac has quit [Ping timeout: 250 seconds]
mr_oh has joined #ruby
Aswebb_ has joined #ruby
rmulliga` has quit [Remote host closed the connection]
<mr_oh>
Is there a way to do something like: write_to_file + "stuff...." , instead of typing out write_to_file every time?
<Ox0dea>
mr_oh: For what it's worth, decent editor would let you write "w<Tab>" instead of having to spell it out every time.
<mr_oh>
Atom seems kind of slow at that
<Ox0dea>
I believe it.
<Ox0dea>
I said a decent editor. :P
<mr_oh>
:-)
Biohazard has joined #ruby
<Ox0dea>
You could stick all the strings in an Array and say `strings.each { |s| write_to_file s }` or some such, but that's not much of an improvement.
Biohazard is now known as Guest45768
<Ox0dea>
Do nix all those comments, though.
moeabdol has joined #ruby
<mr_oh>
ok
pawnbox has joined #ruby
merida has joined #ruby
frozen3 has quit [Read error: Connection reset by peer]
<mr_oh>
I thought about initalizing values elsewhere and getting at them in the process_ methods
noService has joined #ruby
<Ox0dea>
That's not a bad idea.
<mr_oh>
But I haven't gotten into class and all that yet
dravine has joined #ruby
hanmac has joined #ruby
<baweaver>
also what's write_to_file
<mr_oh>
suprising, but @variables work without any defined classes
<shevy>
I believe it writes to a file
<baweaver>
kinda unnecessary honestly.
aces1up has joined #ruby
aces1up has quit [Client Quit]
<baweaver>
it's more of output to file, not process_products
<shevy>
mr_oh yeah but actually when you are already using @variables, it's just a tiny extra step to write classes
rubie has quit [Remote host closed the connection]
<mr_oh>
I should just do a class or two...
frozen3 has joined #ruby
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<mr_oh>
well even if I do $file.puts "xcxcc", I'm still typing $file.puts on every line, no?
<Ox0dea>
mr_oh: You can pass multiple arguments to #puts.
karioleez has joined #ruby
<Ox0dea>
Also, @instance_variables don't go on classes; they go on instances.
<Ox0dea>
More precisely, `self` is `main` at the top level, and Object is the "default definee".
CloCkWeRX has joined #ruby
Inside has joined #ruby
Inside has joined #ruby
* mr_oh
punches screen
sorbo_ has quit [Remote host closed the connection]
wilbert has quit [Ping timeout: 276 seconds]
poguez_ has quit [Quit: Connection closed for inactivity]
pawnbox has joined #ruby
CloCkWeRX has quit [Ping timeout: 260 seconds]
MyMind has quit [Ping timeout: 240 seconds]
lyoshajapan has quit [Remote host closed the connection]
DTZUZU has joined #ruby
fedexo has joined #ruby
benlieb has quit [Quit: benlieb]
benlieb has joined #ruby
bkxd has joined #ruby
<shevy>
are you punching any particular nick mr_oh :)
TheCubeLord has quit [Quit: ╯°□°)╯︵ǝpouǝǝɹɟ]
sgambino has joined #ruby
Chagel has quit [Ping timeout: 244 seconds]
DTZUZU has quit [Ping timeout: 250 seconds]
uglybandersnatch has joined #ruby
benlieb has quit [Ping timeout: 276 seconds]
bkxd has quit [Ping timeout: 276 seconds]
paradisaeidae has joined #ruby
<mr_oh>
Just the computer in general
<Ox0dea>
How come?
vale_tudo has quit [Ping timeout: 264 seconds]
jt__ has joined #ruby
<shevy>
don't let the AIs rise
sorbo_ has joined #ruby
kariolee_ has joined #ruby
Gooer has joined #ruby
hahuang61 has joined #ruby
<paradisaeidae>
So I've compiled Ruby 2.3.0. Looks like my gem's extension need recompiling. As rb_data_object_alloc is DEPRECATED_BY(rb_data_object_wrap
<paradisaeidae>
Though when invoking gem, it loads the gems, one is ffi which halts.
<paradisaeidae>
So cannot rebuild.
karioleez has quit [Ping timeout: 252 seconds]
<paradisaeidae>
Is there an option in building Ruby which gets over this?
<mr_oh>
Ox0dea: It's just frustrating not knowing enough yet.
CloCkWeRX has joined #ruby
<Ox0dea>
mr_oh: Anger is hardly the most appropriate response to (temporary) ignorance.
Gooer_ has joined #ruby
hahuang61 has quit [Ping timeout: 246 seconds]
<mr_oh>
It isn't. But it built up over the course of the evening.
<Ox0dea>
¯\_(ツ)_/¯
<Ox0dea>
Aim for "Fuck yeah! New shit to learn."
<Ox0dea>
All things in moderation, of course.
Gooer has quit [Ping timeout: 240 seconds]
Gooer_ has quit [Read error: Connection reset by peer]
teejayen has joined #ruby
minimalism has quit [Read error: Connection reset by peer]
lyoshajapan has joined #ruby
frozen3 has quit [Read error: Connection reset by peer]
BoxDevelopment_ has quit []
S01780 has joined #ruby
minimalism has joined #ruby
gevans has quit [Remote host closed the connection]
lyoshajapan has quit [Remote host closed the connection]
tneilen has joined #ruby
<Ox0dea>
paradisaeidae: Could you clarify? The ffi gem doesn't use rb_data_object_alloc(), so its relevance is unclear.
frozen3 has joined #ruby
teej has quit [Ping timeout: 252 seconds]
postmodern has quit [Quit: Leaving]
lyoshajapan has joined #ruby
<paradisaeidae>
Hi, I see this: gems/ffi-1.9.10/lib/ffi_c.so: undefined symbol: rb_data_object_alloc
nando293921 has quit [Ping timeout: 252 seconds]
uglybandersnatch has quit [Ping timeout: 250 seconds]
maxxe has quit [Remote host closed the connection]
<paradisaeidae>
Has it been linked in by a previous compile with Ruby 2.2.2?
teejayen has quit [Ping timeout: 252 seconds]
<Ox0dea>
Yes, that seems the most likely cause.
<Ox0dea>
Re-installing the gem should clear that right up.
<paradisaeidae>
Looks like I have to remove it with 2.2.2 then install it with 2.3.0
statelesscode has quit [Quit: statelesscode]
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sauvin has joined #ruby
rmulligan has quit [Ping timeout: 268 seconds]
<Ox0dea>
Yeah, gems are per-version unless you go out of your way to share them across, which isn't a great idea in the first place.
last_staff has joined #ruby
arescorpio has quit [Remote host closed the connection]
Xiti has quit [Ping timeout: 240 seconds]
Inside has quit [Ping timeout: 250 seconds]
sgambino has joined #ruby
lyoshajapan has quit [Remote host closed the connection]
yatish27 has quit []
tref has quit [Quit: tref]
Chagel has joined #ruby
Devalo has joined #ruby
lyoshajapan has joined #ruby
UKn0Meh is now known as UKn0Me
tneilen has quit [Read error: Connection reset by peer]
kariolee_ has quit [Remote host closed the connection]
IrishGringo has quit [Ping timeout: 260 seconds]
hxegon has quit [Quit: BRB]
Gooer_ has joined #ruby
Elysia has joined #ruby
tref has joined #ruby
benlovell has joined #ruby
tubuliferous_ has quit [Ping timeout: 276 seconds]
hotpancakes has quit [Remote host closed the connection]
lyoshajapan has quit [Remote host closed the connection]
Gooer_ has quit [Quit: Leaving]
Gooer has joined #ruby
Gooer_ has joined #ruby
benlovell has quit [Ping timeout: 244 seconds]
Gooer_ has quit [Remote host closed the connection]
Gooer_ has joined #ruby
bronson has joined #ruby
hotpancakes has joined #ruby
juria_roberts has joined #ruby
DiabolikFreenode is now known as Diabolik
Oog has joined #ruby
mr_oh has quit [Quit: Page closed]
<juria_roberts>
How do i merge the arrays instead of it being overwritten? https://repl.it/CAym/0
jaruga has joined #ruby
bronson has quit [Ping timeout: 252 seconds]
Xiti has joined #ruby
jaruga has quit [Client Quit]
spuk has quit [Ping timeout: 260 seconds]
<baweaver>
juria_roberts: Look into the merge function
<roelof>
But still I think answer << number schould be a array not seperate numbers
<norc>
roelof: Calling join on an array coerces all elements to string and then joins them together. Thus [10, 11].join would produce a String "1011". Calling to_i on that converts that string back to a number.
<madgen>
well the answer is an array and you are adding all permutations
<norc>
Just to answer your initial question.
<madgen>
it is an array
<madgen>
puts prints all array values in a newline
<roelof>
manveru: thanks, have not learned about the permutations function
hanmac has joined #ruby
wethu has quit [Quit: This computer has gone to sleep]
DTZUZU has joined #ruby
riffraff has joined #ruby
GitGud has joined #ruby
creat has quit [Ping timeout: 260 seconds]
jdawgaz has joined #ruby
jdawgaz has quit [Client Quit]
noService has quit [Ping timeout: 246 seconds]
polysics_ has quit []
Brando753 has quit [Ping timeout: 248 seconds]
polysics has joined #ruby
frozen3 has quit [Read error: Connection reset by peer]
creat has joined #ruby
frozen3_ has joined #ruby
roelof has quit [Quit: Page closed]
m8 has joined #ruby
leon_ee has quit [Remote host closed the connection]
leon_ee has joined #ruby
chouhoulis has joined #ruby
IrishGringo has quit [Ping timeout: 264 seconds]
DTZUZU has quit [Ping timeout: 244 seconds]
dravine has joined #ruby
SCHAAP137 has joined #ruby
User458764 has joined #ruby
frozen3_ has quit [Read error: Connection reset by peer]
benlovell has joined #ruby
jorum has quit [Quit: Lost terminal]
chouhoulis has quit [Ping timeout: 252 seconds]
StyXman has left #ruby [#ruby]
LoneHerm_ has joined #ruby
pandaant has quit [Remote host closed the connection]
brt has quit [Quit: peace]
blackgoat has quit [Quit: WeeChat 1.4]
joonty has quit [Ping timeout: 252 seconds]
skweek has quit [Ping timeout: 260 seconds]
bqscott_ is now known as bqscott
drewo has joined #ruby
baweaver has joined #ruby
n008f4g_ has joined #ruby
inukshuk_ has joined #ruby
inukshuk_ has quit [Client Quit]
krz has joined #ruby
Xeago has quit [Remote host closed the connection]
drewo has quit [Ping timeout: 264 seconds]
Xeago has joined #ruby
baweaver has quit [Ping timeout: 248 seconds]
GodFather has quit [Ping timeout: 244 seconds]
benlovel1 has joined #ruby
hotpancakes has joined #ruby
joonty has joined #ruby
zzz__ has joined #ruby
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #ruby
benlovell has quit [Ping timeout: 276 seconds]
jdawgaz has joined #ruby
bkxd has joined #ruby
decoponio has quit [Quit: Leaving...]
hotpancakes has quit [Ping timeout: 248 seconds]
Snowy has quit [Ping timeout: 248 seconds]
pydave6367 has quit [Quit: leaving]
aupadhye has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
User458764 has joined #ruby
bkxd has quit [Ping timeout: 244 seconds]
codecop has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
leon_ee has quit [Remote host closed the connection]
duckpuppy has joined #ruby
Xeago has quit [Remote host closed the connection]
SenpaiSilver has quit [Quit: Leaving]
Xeago has joined #ruby
Madplatypus has quit [Quit: Connection closed for inactivity]
Vile` has joined #ruby
hays has quit [Read error: Connection reset by peer]
CloCkWeRX has quit [Ping timeout: 250 seconds]
NightMonkey has quit [Ping timeout: 244 seconds]
neanderslob has quit [Quit: No Ping reply in 180 seconds.]
neanderslob has joined #ruby
madgen has quit [Ping timeout: 276 seconds]
merida has quit [Remote host closed the connection]
rmulligan has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
dvinciguerra__ has quit [Ping timeout: 276 seconds]
NightMonkey has joined #ruby
Snowy has joined #ruby
hightower3 has quit [Ping timeout: 250 seconds]
rmulligan has quit [Ping timeout: 252 seconds]
aryaching has joined #ruby
madgen has joined #ruby
pawnbox has joined #ruby
jaruga_ has joined #ruby
aryaching has quit [Client Quit]
gaf_ has quit [Ping timeout: 244 seconds]
statelesscode has joined #ruby
jaruga_ has quit [Client Quit]
jaruga_ has joined #ruby
hightower3 has joined #ruby
krz has quit [Ping timeout: 248 seconds]
Gasher has joined #ruby
cpup has quit [Ping timeout: 248 seconds]
lyoshajapan has joined #ruby
LoneHerm_ has quit [Remote host closed the connection]
aryaching has joined #ruby
CloCkWeRX has joined #ruby
gaf_ has joined #ruby
krz has joined #ruby
cpup has joined #ruby
lyoshajapan has quit [Remote host closed the connection]
<n1colas>
Hello
vondruch has quit [Quit: Ex-Chat]
<TheBrayn>
hello
skweek has joined #ruby
tvw has quit [Remote host closed the connection]
tvw has joined #ruby
djcp1 has joined #ruby
hotpancakes has joined #ruby
siaw has quit [Quit: siaw]
chouhoulis has joined #ruby
solars has quit [Quit: WeeChat 0.4.2]
ekinmur has joined #ruby
torandu has quit [Ping timeout: 248 seconds]
the_drow has quit [Quit: This computer has gone to sleep]
lyoshajapan has joined #ruby
konsolebox has joined #ruby
hotpancakes has quit [Ping timeout: 276 seconds]
drewo has joined #ruby
chouhoulis has quit [Ping timeout: 264 seconds]
torandu has joined #ruby
hightower3 has quit [Ping timeout: 244 seconds]
krobzaur has joined #ruby
peteykun has joined #ruby
ekinmur has quit [Client Quit]
ekinmur has joined #ruby
drewo has quit [Ping timeout: 252 seconds]
hxegon has joined #ruby
hightower3 has joined #ruby
Vile` has quit [Ping timeout: 240 seconds]
aryaching has quit [Ping timeout: 244 seconds]
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cdg has joined #ruby
sudoubuntu has joined #ruby
konsolebox has quit [Quit: Leaving]
sgambino has joined #ruby
darkf has quit [Quit: Leaving]
Xeago has quit [Remote host closed the connection]
jeffsouz4 has joined #ruby
jeffsouz4 has left #ruby ["WeeChat 1.4"]
jeffsouz4 has joined #ruby
MaienM has quit [Ping timeout: 252 seconds]
AlexJakeGreen has joined #ruby
jeffsouz4 has left #ruby ["WeeChat 1.4"]
Ishido has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
hightower3 has quit [Ping timeout: 244 seconds]
skade has joined #ruby
rbennacer has joined #ruby
decoponio has joined #ruby
_stu_ has joined #ruby
malconis has joined #ruby
Chagel has joined #ruby
IrishGringo has joined #ruby
Spami_ has quit [Read error: Connection reset by peer]
Spami_ has joined #ruby
tref has quit [Quit: tref]
Ropeney has quit [Quit: Leaving]
Gasher has quit [Ping timeout: 276 seconds]
Xeago has joined #ruby
hxegon has quit [Quit: BRB]
rmulligan has joined #ruby
MaienM has joined #ruby
roelof has joined #ruby
aryaching has joined #ruby
CloCkWeRX has quit [Ping timeout: 252 seconds]
<roelof>
why do I get a non-method error here : nums.inject(1) { |answer, number| sum = sum * number } I thought I could multiply with * ?
benlovel1 has quit [Ping timeout: 276 seconds]
patrick_star has quit [Quit: Leaving]
patrick_star has joined #ruby
DTZUZU has joined #ruby
noService has joined #ruby
<apeiros>
roelof: read your code. pay attention to the variable names.
nickjj_ is now known as nickjj
pandaant has joined #ruby
rmulligan has quit [Ping timeout: 264 seconds]
benlovell has joined #ruby
c999 has quit [Quit: ChatZilla 0.9.92 [Firefox 45.0.1/20160315153207]]
gregf has quit [Ping timeout: 276 seconds]
<roelof>
apeiros: thanks, I think I need a break
freerobby has joined #ruby
konsolebox has joined #ruby
hotpancakes has joined #ruby
aryaching has quit [Read error: Connection reset by peer]
freerobby has quit [Remote host closed the connection]
inukshuk_ has joined #ruby
sudoubuntu has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
inukshuk_ has quit [Client Quit]
benlovell has quit [Read error: Connection reset by peer]
aryaching has joined #ruby
MaienM has quit [Ping timeout: 244 seconds]
uglybandersnatch has joined #ruby
hotpancakes has quit [Ping timeout: 244 seconds]
nanoz has joined #ruby
hxegon has joined #ruby
hamed_r has joined #ruby
<madgen>
roelof: also that's now how you want to use inject it suffices to state the operation in the block eg. sum * number and the assignment back to sum is not necessary.
<madgen>
>> (1..10).inject(1) { |sum, number| sum * number }
benlovell has joined #ruby
uglybandersnatch has quit [Ping timeout: 260 seconds]
hotpancakes has joined #ruby
dhollinger has joined #ruby
<madgen>
and even the argument to inject is optional as when you don't pass that argument, inject just initialises the accumulator to the first element in the list. In this case very conveniently 1, but for just doing a product it doesn't even have to be 1.
mdw_ has quit [Quit: Sleeping Zzzzz]
n008f4g_ has quit [Ping timeout: 244 seconds]
aegis3121 has joined #ruby
bkxd has joined #ruby
CloCkWeRX has joined #ruby
roshanavand has joined #ruby
GodFodder has joined #ruby
GodFodder has quit [Max SendQ exceeded]
GodFodder has joined #ruby
GodFodder has quit [Max SendQ exceeded]
quazimodo has joined #ruby
GodFodder has joined #ruby
GodFodder has quit [Max SendQ exceeded]
krz has quit [Ping timeout: 244 seconds]
GodFodder has joined #ruby
fexilal has joined #ruby
bkxd has quit [Ping timeout: 276 seconds]
Xeago has quit [Remote host closed the connection]
drewo has joined #ruby
idletask has quit [Ping timeout: 240 seconds]
idletask has joined #ruby
saneax is now known as saneax_AFK
openstruct has joined #ruby
TomyLobo has quit [Ping timeout: 260 seconds]
chouhoulis has joined #ruby
ChiefAlexander has joined #ruby
roelof has quit [Quit: Page closed]
CloCkWeRX has quit [Quit: Leaving.]
bry4n_ has joined #ruby
drewo has quit [Ping timeout: 252 seconds]
krz has joined #ruby
chouhoulis has quit [Ping timeout: 244 seconds]
stannard has joined #ruby
bry4n_ has quit [Ping timeout: 268 seconds]
tvw has quit []
<apeiros>
madgen: they could even just do .inject(:*)
hotpancakes has quit [Remote host closed the connection]
<madgen>
I suggested that earlier it got lost I think
tref has joined #ruby
aryaching_ has joined #ruby
aryaching has quit [Ping timeout: 240 seconds]
wilbert has joined #ruby
rubie has joined #ruby
anisha has quit [Quit: Leaving]
aryaching_ has quit [Read error: Connection reset by peer]
sinanislekdemir has quit [Remote host closed the connection]
tref has quit [Quit: tref]
Brando753 has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
VeryBewitching has joined #ruby
blandflakes has joined #ruby
<VeryBewitching>
o/
rmulligan has joined #ruby
openstruct has quit []
madgen has quit [Ping timeout: 276 seconds]
krz has quit [Ping timeout: 250 seconds]
madgen has joined #ruby
hotpanca_ has joined #ruby
Guest14434 has joined #ruby
konsolebox has quit [Quit: Leaving]
bry4n_ has joined #ruby
<benzrf>
hi
ekinmur has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
siaw has joined #ruby
rmulligan has quit [Ping timeout: 276 seconds]
norc has quit [Ping timeout: 250 seconds]
krz has joined #ruby
bkxd has joined #ruby
mdw has joined #ruby
yqt has joined #ruby
djcp1 has quit [Ping timeout: 276 seconds]
krz has quit [Ping timeout: 244 seconds]
Es0teric has quit [Quit: Computer has gone to sleep.]
Es0teric has joined #ruby
bkxd has quit [Ping timeout: 260 seconds]
melter has quit [Ping timeout: 250 seconds]
skweek has quit [Ping timeout: 246 seconds]
ekinmur has joined #ruby
krz has joined #ruby
bkxd has joined #ruby
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Chagel has quit [Ping timeout: 264 seconds]
Guest6001 has joined #ruby
bluOxigen has quit [Ping timeout: 248 seconds]
bkxd has quit [Ping timeout: 248 seconds]
b|ackwolf has joined #ruby
<b|ackwolf>
what is the common way to sandboxing dependencies these days?
Devalo has joined #ruby
Devalo has quit [Remote host closed the connection]
rippa has joined #ruby
FooMunki has quit [Quit: FooMunki]
<apeiros>
b|ackwolf: bundler
FooMunki has joined #ruby
twistedpixels has quit [Ping timeout: 260 seconds]
Devalo has joined #ruby
TvL2386 has quit [Quit: Ex-Chat]
<b|ackwolf>
apeiros, for example; when I install rails, 4.2.1 (in vendor/bundle) and I try to create a new Rails application bundler tries to install dependencies again for that project.
joonty has quit [Ping timeout: 264 seconds]
dvinciguerra__ has joined #ruby
<b|ackwolf>
apeiros, how can I get rid of downloading the gems every time I run bundle exec rails new app_name ?
stunder has joined #ruby
<apeiros>
b|ackwolf: I'm afk now, but I'm pretty sure it's somewhere in bundlers docs
kies has joined #ruby
joonty has joined #ruby
karioleez has quit [Read error: Connection reset by peer]
<b|ackwolf>
apeiros, oh sorry, thanks for your mention.
melter has joined #ruby
Devalo has quit [Remote host closed the connection]
rubie has quit [Remote host closed the connection]
aegis3121 has quit [Ping timeout: 244 seconds]
drewo has joined #ruby
DEac-_ has quit [Quit: leaving]
DEac- has joined #ruby
lyoshajapan has quit []
twistedpixels has joined #ruby
karioleez has joined #ruby
djcp1 has joined #ruby
djcp1 has quit [Client Quit]
GodFodder has quit [Ping timeout: 250 seconds]
sgambino has joined #ruby
statelesscode has quit [Quit: statelesscode]
drewo has quit [Ping timeout: 276 seconds]
nfk|laptop has quit [Ping timeout: 244 seconds]
FooMunki has quit [Quit: FooMunki]
madgen has quit [Ping timeout: 248 seconds]
agit0 has quit [Quit: zzzZZZ….]
b|ackwolf has quit [Quit: Leaving]
peteykun has quit [Quit: Leaving]
FooMunki has joined #ruby
rubie has joined #ruby
madgen has joined #ruby
skislak has quit [Ping timeout: 244 seconds]
skweek has joined #ruby
rkazak has joined #ruby
x77686d has joined #ruby
ferr has quit [Quit: WeeChat 1.4]
pandaant has quit [Quit: Lost terminal]
ekinmur has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
goodroot has joined #ruby
aufi has quit [Ping timeout: 276 seconds]
yqt has quit [Ping timeout: 268 seconds]
ekinmur has joined #ruby
phpwebdev has joined #ruby
stunder has quit [Ping timeout: 244 seconds]
AlexJakeGreen has quit [Remote host closed the connection]
jaruga_ has quit [Quit: jaruga_]
krz has quit [Ping timeout: 246 seconds]
karioleez has quit [Remote host closed the connection]
platzhirsch has left #ruby [#ruby]
krz has joined #ruby
polishdub has joined #ruby
ChiefAlexander has quit [Quit: Leaving...]
whippythellama has quit [Ping timeout: 250 seconds]
x77686d has quit [Read error: Connection reset by peer]
x77686d has joined #ruby
hotpanca_ has quit []
rmulligan has joined #ruby
johnny56_ has joined #ruby
mrgrieve1 has joined #ruby
dopamean_ has joined #ruby
riffraff_ has joined #ruby
roshanavand has quit [Read error: Connection reset by peer]
dikaio has joined #ruby
mrgrieves has quit [Ping timeout: 240 seconds]
roshanavand has joined #ruby
riffraff_ has quit [Client Quit]
davee_ has joined #ruby
johnny56 has quit [Ping timeout: 264 seconds]
whippythellama has joined #ruby
riffraff has quit [Ping timeout: 250 seconds]
GitGud has quit [Quit: I leave because I don't chill with criminals who sniff chemicals. I'm going to sniff gasoline now bye]
hxegon has quit [Quit: PEACE OUT]
rubie has quit [Remote host closed the connection]
rmulligan has quit [Ping timeout: 248 seconds]
dravine_ has joined #ruby
FooMunki has quit [Quit: FooMunki]
hanmac has quit [Ping timeout: 250 seconds]
FooMunki has joined #ruby
dravine has quit [Ping timeout: 246 seconds]
dravine_ is now known as dravine
GitGud has joined #ruby
dikaio_ has joined #ruby
CausaMortis has quit [Ping timeout: 244 seconds]
rkazak has quit [Quit: Sleep.....ing....]
wilbert has quit [Ping timeout: 260 seconds]
dikaio_ has quit [Max SendQ exceeded]
wilbert has joined #ruby
dikaio_ has joined #ruby
madgen has quit [Ping timeout: 244 seconds]
dikaio has quit [Ping timeout: 264 seconds]
roshanavand has quit [Quit: Leaving]
maletor has joined #ruby
Devalo has joined #ruby
ssiris has joined #ruby
nanoz has quit [Ping timeout: 268 seconds]
torandu has quit [Ping timeout: 244 seconds]
whippythellama has quit [Ping timeout: 264 seconds]
SCHAAP137 has quit [Remote host closed the connection]
madgen has joined #ruby
torandu has joined #ruby
mistermocha has joined #ruby
freerobby has joined #ruby
KensoDev has joined #ruby
skade has joined #ruby
rkazak has joined #ruby
Devalo has quit [Remote host closed the connection]
Kimm has joined #ruby
dc4 has joined #ruby
bkxd has joined #ruby
gregf has joined #ruby
misterm__ has quit [Ping timeout: 260 seconds]
forest has joined #ruby
forest is now known as Guest88581
dmr8 has joined #ruby
<Kimm>
Hi, I'm trying to use ruby c api, i'm trying to compile like so gcc call.c -o call -I/home/wh/.rbenv/versions/2.1.6/include/ruby-2.1.0/ but i get error `ruby.h:24:25: fatal error: ruby/config.h: No such file or directory`
Silox| has quit [Quit: Connection closed for inactivity]
Gasher has joined #ruby
rbennacer has quit [Remote host closed the connection]
bkxd has quit [Ping timeout: 252 seconds]
rkazak has quit [Quit: Sleep.....ing....]
rbennacer has joined #ruby
howdoi has joined #ruby
pandaant has joined #ruby
rbennacer has quit [Remote host closed the connection]
benlieb has joined #ruby
rbennacer has joined #ruby
karioleez has joined #ruby
amclain has joined #ruby
andikr has quit [Remote host closed the connection]
<benlieb>
are "class instance variables" the same as "instance variables"
diegoaguilar has joined #ruby
<apeiros>
benlieb: yes
Kero has quit [Ping timeout: 252 seconds]
<benlieb>
tnx
<apeiros>
it's just a fancy way to say that they're associated with an object whose class is Class (or Module)
smathy has joined #ruby
freerobby has quit [Quit: Leaving.]
machinewar has joined #ruby
bronson has joined #ruby
shredding has joined #ruby
<benlieb>
gotcha, I guess most developers just say "instance variable", but a lot of blogs (being formal) use "class instance variable". I just wanted to make double sure
minimalism has quit [Quit: minimalism]
<machinewar>
anyone experienced using CSV setting headers: true. When I give it a afile with only one row (the headers) it doesn't recongnize them as headers
mistermocha has quit [Remote host closed the connection]
hanmac has joined #ruby
<machinewar>
has anyone seen this before / have a non-hacky solution (i.e. adding a fake row beneath)
<benlieb>
I'm trying to make sure my rails app is thread safe, and it's kinda scary
<benlieb>
There is a section called "Class instance variables" that says that "Class instance variables" can be not thread safe
<benlieb>
"In this case, calling the layout method causes Rails to set the class instance variable @_layout for the controller class. If two concurrent requests (served by two threads) hit this code simultaneously, they might end up in a race condition and overwrite each others’ layout."
<benlieb>
So it seems like class instance vars are set outside of a method, and a "instance" var isn't?
mistermo_ has joined #ruby
A124 has joined #ruby
<benlieb>
confused
rkazak has joined #ruby
workmad3 has quit [Ping timeout: 276 seconds]
Kero has joined #ruby
rolha has quit [Read error: Connection reset by peer]
hightower3 has joined #ruby
benlovell has quit [Ping timeout: 244 seconds]
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mistermocha has quit [Ping timeout: 244 seconds]
rolha has joined #ruby
imperator has joined #ruby
stunder has joined #ruby
<imperator>
good morning
matt_d_ is now known as matt_d
TomyLobo has joined #ruby
rkazak has quit [Ping timeout: 260 seconds]
mrgrieve1 has quit [Ping timeout: 244 seconds]
Couch has quit [Ping timeout: 244 seconds]
edwinvdgraaf has quit [Remote host closed the connection]
mistermocha has joined #ruby
graywh has joined #ruby
<imperator>
anyone know how to parse an iso 8601 interval string into a Ruby object?
smathy has joined #ruby
<imperator>
e.g. "P10675199DT2H48M5.4775807S"
graywh has left #ruby [#ruby]
aganov has quit [Remote host closed the connection]
<imperator>
is there a core/stdlib method out there somewhere i'm missing?
dionysus69 has quit [Ping timeout: 244 seconds]
n008f4g_ has joined #ruby
shredding has quit [Ping timeout: 260 seconds]
benlovell has joined #ruby
frem has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
Don_John has joined #ruby
Xeago has joined #ruby
symm- has joined #ruby
cjbottaro has joined #ruby
joonty has quit [Ping timeout: 248 seconds]
Miron has quit [Ping timeout: 248 seconds]
nando293921 has joined #ruby
djcp1 has joined #ruby
zzz__ has quit [Quit: Leaving...]
mark2 has quit [Remote host closed the connection]
skweek has quit [Ping timeout: 240 seconds]
benlovell has quit [Ping timeout: 276 seconds]
bhaak has joined #ruby
tristanp_ has joined #ruby
madgen has quit [Ping timeout: 264 seconds]
rmulligan has joined #ruby
Miron has joined #ruby
pandaant has quit [Remote host closed the connection]
tristanp has quit [Ping timeout: 260 seconds]
marxarelli has joined #ruby
Xeago has quit [Remote host closed the connection]
sgambino has joined #ruby
merida has joined #ruby
poguez_ has joined #ruby
Es0teric has quit [Quit: Computer has gone to sleep.]
chouhoulis has joined #ruby
rmulligan has quit [Ping timeout: 248 seconds]
benlovell has joined #ruby
whippythellama has joined #ruby
User458764 has joined #ruby
bronson has quit [Remote host closed the connection]
mikecmpbll has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
drewo has joined #ruby
Spami_ has quit [Ping timeout: 248 seconds]
freerobby has joined #ruby
merida has quit [Remote host closed the connection]
freerobby1 has joined #ruby
merida has joined #ruby
Gasher has quit [Quit: Leaving]
<darix>
imperator: that's not correct iso date no?
<darix>
that would be more in the line of 2016-03-31T16:35:04+00:00
sneakerhax has quit [Ping timeout: 250 seconds]
hightower3 has quit [Ping timeout: 250 seconds]
hightower2 has joined #ruby
freerobby has quit [Ping timeout: 260 seconds]
benlovell has quit [Read error: Connection reset by peer]
thomashaw has joined #ruby
tristanp has joined #ruby
cwong_on_irc has joined #ruby
cwong_on_irc was kicked from #ruby by ruby[bot] [was banned before]
<benlieb>
apeiros: I may have misunderstood you before, but on further reading it appears that "class instance variables" are definitely not the same as "instance variables".
tristanp has quit [Read error: Connection reset by peer]
Spami_ has joined #ruby
baweaver has quit [Remote host closed the connection]
tristanp_ has quit [Ping timeout: 244 seconds]
tristanp has joined #ruby
<apeiros>
benlieb: sorry, missed your earlier ping
duderonomy has quit [Ping timeout: 250 seconds]
<apeiros>
benlieb: no, you didn't misunderstand me. class *instance* variables are definitively the same as instance variables
IrishGringo has quit [Ping timeout: 246 seconds]
<apeiros>
class variables are something different, though. @@class_variables, @instance_variables.
<apeiros>
darix: he's talking about interval, not time. that's also specified by iso8601
moei has quit [Quit: Leaving...]
djbkd has joined #ruby
zapata has joined #ruby
benlovell has joined #ruby
<apeiros>
benlieb: I think "class instance variables can't be thread-safe" is a mischaracterization. I won't read the full article, but it's all about what they say at the start: it matters whether you share mutable state or not.
<apeiros>
and as it is in ruby, you can share *all* variable types across threads, even local variables.
<apeiros>
benlieb: yeah, "class methods" is again, just a fancy term for "instance methods on the object's singleton_class"
<apeiros>
there's only one kind of methods in ruby, and that's instance methods.
<apeiros>
it's just more convenient to say "class method". and it's widely understood what is meant. even though sadly many rubyists miss the technical background.
djbkd has quit [Ping timeout: 268 seconds]
<imperator>
darix, is it not correct? quite possible, this is coming from MS
B1n4r10 has joined #ruby
wilbert has quit [Ping timeout: 264 seconds]
Spami has joined #ruby
ChiefAlexander has joined #ruby
agit0 has joined #ruby
Spami_ has quit [Ping timeout: 276 seconds]
Spami_ has joined #ruby
<imperator>
apeiros, yes :)
barajasfab has joined #ruby
m4dfry has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
mdw has quit [Quit: Sleeping Zzzzz]
GitGud has quit [Ping timeout: 248 seconds]
davedev24 has joined #ruby
Spami has quit [Ping timeout: 264 seconds]
CausaMortis has joined #ruby
SCHAAP137 has joined #ruby
IrishGringo has joined #ruby
hxegon is now known as hxegon_AFK
<imperator>
well, i did find the iso8601 gem, which has ISO8601::Duration and seems to parse it properly
dopie has quit [Ping timeout: 260 seconds]
freerobby1 has quit [Quit: Leaving.]
tristanp_ has joined #ruby
karioleez has quit [Remote host closed the connection]
finisherr has joined #ruby
rodfersou is now known as rodfersou|lunch
sepp2k has quit [Ping timeout: 244 seconds]
sepp2k1 has joined #ruby
benlovell has quit [Ping timeout: 244 seconds]
tristanp has quit [Ping timeout: 268 seconds]
stannard_ has joined #ruby
mjc_ has joined #ruby
stannard has quit [Ping timeout: 244 seconds]
KensoDev has joined #ruby
dionysus69 has joined #ruby
hxegon_AFK has quit [Quit: BRB]
vF3hNGxc47h8 has joined #ruby
Guest88581 has quit [Remote host closed the connection]
Outlastsheep has quit [Ping timeout: 244 seconds]
agit0 has quit [Quit: zzzZZZ….]
Xeago has joined #ruby
priodev has quit [Ping timeout: 248 seconds]
karioleez has joined #ruby
merida_ has joined #ruby
<shevy>
apeiros well "class method" is a lot shorter to write than "instance method on the object's singleton_class" - and you may have to explain what a singleton_class is in addition to that in a discussion :-)
merida has quit [Ping timeout: 248 seconds]
choke has joined #ruby
fragtastic has quit [Ping timeout: 240 seconds]
ramfjord has joined #ruby
yeticry has quit [Ping timeout: 248 seconds]
agit0 has joined #ruby
loc22 has joined #ruby
<apeiros>
shevy: I trust in their ability to `ri singleton_class`
<apeiros>
and alternatively in their ability to ask follow-up questions
Kero has quit [Ping timeout: 260 seconds]
priodev has joined #ruby
Spami_ has quit [Quit: Leaving]
fragtastic has joined #ruby
<Zarthus_>
i'm not sure if my brain is having a day off or not, I'm trying to default a value if it is not set, my IDE is complaining that this always evaluates to true: myvar = config['item'] || true -- it is probably right, but I find the alternative of config['item'].nil? ? true : config['item'] longwinded, surely there is a better way I'm just unable to think of right now?
Spami has joined #ruby
Kero has joined #ruby
IrishGringo has quit [Ping timeout: 246 seconds]
vF3hNGxc47h8 has quit [Ping timeout: 246 seconds]
karioleez has quit [Ping timeout: 264 seconds]
rmulligan has joined #ruby
rcvalle has joined #ruby
sneakerhax has joined #ruby
shinnya has joined #ruby
<shevy>
Zarthus_ well it evaluates to true right? because one argument will always be true
Zarthus_ is now known as Zarthus
Xeago has quit [Remote host closed the connection]
DoubleMalt has quit [Remote host closed the connection]
<Zarthus>
yeah, I want it to be the first one if it is set at all
<Zarthus>
the default value should be true, but whenever the config item is made in a yaml file, it should be that value.
_ko1 has quit [Ping timeout: 244 seconds]
Snowy has quit [Remote host closed the connection]
dvinciguerra__ has quit [Ping timeout: 260 seconds]
<djellemah>
Zarthus_: That expression only evaluates to true when config['item'] is nil (or config['item'] is true). Which is what you want.
<shevy>
when will it not be true?
<Zarthus>
when the user's value in the yaml file is false, or any string
<Zarthus>
(but the latter won't be a case)
wilbert has joined #ruby
<shevy>
no I mean
<shevy>
in the evaluation
<shevy>
I can't seem to find a result where it will be false
<Zarthus>
config['item'] is loaded from a yaml file, so it's user edited
Spami has quit [Ping timeout: 244 seconds]
<Zarthus>
it may essentially be anything (but it'd be pebcak if they fill in a non-boolean value)
<Zarthus>
when that value is not in the yaml file though, it should default to true.
<Zarthus>
i'm looking for something that would make for better-readable code than the last case
tildes has quit [Ping timeout: 248 seconds]
<Zarthus>
Some of the YAML items go pretty deep, and you'd be reading much of the same code essentially.
johnny56_ is now known as johnny56
benlieb has quit [Quit: benlieb]
<Zarthus>
and the only solution I seem to be thinking of is to make a method that accepts an item and does it behind the scenes, but this is ruby - surely there's something I'm missing to make my life easier (like a strict null coalising operator)
hxegon has joined #ruby
ocbtec has joined #ruby
<shevy>
Zarthus I haven't been able to go to that part, I am still pondering about what djellemah wrote ;)
Cohedrin has joined #ruby
<Zarthus>
ah
<shevy>
what I do in my projects is to usually sanitize the configuration dataset
<Zarthus>
i'm not very worried about sanitizing of the data
Cohedrin has quit [Max SendQ exceeded]
<shevy>
like I can do "use_colours: t" and it'll become "yes we will use colours"
ekinmur has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Cohedrin has joined #ruby
<shevy>
Zarthus can you set a state of default values?
<shevy>
and then load up the configuration?
<Zarthus>
the defaults that the user will copy (example.config.yaml) will contain all values with predefined values, and there's documentation of what each item expects. If they go and fill in a string where a boolean previously was, they're just dummies.
<Zarthus>
shevy: sorta, I'd prefer not to. I'm aware of ||=
<Kimm>
Hi, I'm trying to use ruby c api, i'm trying to compile like so gcc call.c -o call -I/home/wh/.rbenv/versions/2.1.6/include/ruby-2.1.0/ but i get error `ruby.h:24:25: fatal error: ruby/config.h: No such file or directory`
roelof has joined #ruby
<Zarthus>
in all fairness the once innocent configuration.rb is becoming a bit big right now, but this should be the last edit I make to it and I'm not in the mood of refactoring :)
<Zarthus>
famous last words, anyways.
<shevy>
I have all sort of different size ranges for config values... lemme count
<baweaver>
yeah, I was scratching my head on why that worked myself
<smathy>
kellabyte, nope, that `status = ` line doesn't work, maybe it's %x instead of %Q ?
<borodin>
I installed rbenv using puppet-rbenv module, but ruby is still the ols system ruby for regular users. Does anyone know what could be wrong or how to troubleshoot?
krz has quit [Read error: Connection reset by peer]
madgen has joined #ruby
LaT0rtue has quit [Read error: Connection reset by peer]
Cohedrin_ has joined #ruby
krz has joined #ruby
Cohedrin_ has quit [Max SendQ exceeded]
CausaMortis has quit [Ping timeout: 240 seconds]
nikger has quit [Remote host closed the connection]
Cohedrin_ has joined #ruby
moeabdol1 has quit [Ping timeout: 252 seconds]
symm- has joined #ruby
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Cohedrin has quit [Ping timeout: 260 seconds]
mdw_ has joined #ruby
ramfjord has joined #ruby
BSaboia has joined #ruby
Todd has quit [Quit: WeeChat 0.4.2]
Yiota_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
yfeldblum has joined #ruby
moss has joined #ruby
mdw has quit [Ping timeout: 244 seconds]
mdw has joined #ruby
<Kimm>
rb_protect( (VALUE (*)(VALUE))rb_require, (VALUE) "test.rb", &error); //causes segfault, anyone had this problem?
the_drow has quit [Quit: This computer has gone to sleep]
jdawgaz has joined #ruby
bronson has joined #ruby
rmulligan has quit [Remote host closed the connection]
baweaver has quit [Remote host closed the connection]
<Ox0dea>
Kimm: You can't just cast a char * to VALUE like that.
sudoubuntu has joined #ruby
mdw_ has quit [Ping timeout: 246 seconds]
<Kimm>
I forgot to ruby_init()
spider-mario has joined #ruby
BSaboia has quit [Quit: Leaving]
bronson has quit [Ping timeout: 252 seconds]
sergey_makagon has quit [Remote host closed the connection]
bkxd has joined #ruby
x0f has quit [Ping timeout: 268 seconds]
<moss>
hi. i'm trying to do the following and am having trouble getting started: find directory names located at /sys/class/net/* - for every directory name, get the value of /sys/class/net/{dirname}/operstate, if the value is up, check /etc/sysconfig/network-scripts/ifcfg-{dirname} for the string 'BOOTPROTO="dhcp"' - if it exists, return true.
jenrzzz has joined #ruby
KensoDev has quit [Max SendQ exceeded]
stannard has joined #ruby
<moss>
If anyone's willing to help me get started with this, I'd appreciate it
sergey_makagon has joined #ruby
<Papierkorb>
moss: See Dir#glob for finding the folders, File.exist? to check for the file (Or Pathname#file?), File.read or Pathname#read to read the file, Pathname#dir? for the network-scripts stuff, and Array#grep for the "contains this string" stuff
<Papierkorb>
moss: I think using Pathname() is much nicer on the long run when dealing with path magic and files/directories, but you can also use File.exist? and friends if you like them more
sarbs has quit [Ping timeout: 244 seconds]
<moss>
Papierkorb: Thank you
<moss>
I will look into this
<moss>
This is all for puppet facter..
bkxd has quit [Ping timeout: 268 seconds]
<moss>
Papierkorb: won't Dir.glob return all the files in that folder?
<Papierkorb>
moss: Nope, .glob works like in bash
<moss>
ah
baweaver has joined #ruby
<Papierkorb>
moss: You can also write Dir['foo/bar*'] instead of Dir.glob('foo/bar*') ;)
<Kimm>
!paste
lemur has joined #ruby
Musashi007 has quit [Quit: Musashi007]
djbkd_ has joined #ruby
Aviio has joined #ruby
sarbs has joined #ruby
Xeago has quit [Ping timeout: 276 seconds]
dvinciguerra has quit [Ping timeout: 252 seconds]
bphogan has left #ruby [#ruby]
pawnbox has quit [Remote host closed the connection]
<moss>
Papierkorb: the problem is that I need ruby to find the names of the directories and edit files based on the name of the directory
CausaMortis has joined #ruby
Aviio has quit [Remote host closed the connection]
Aviio has joined #ruby
<moss>
so how do i include a variable in File.open?
pawnbox has joined #ruby
<moss>
or File.read
howdoi has quit [Quit: Connection closed for inactivity]
stunder has joined #ruby
tvon has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0dea>
Kimm: Anything, really. Top-level method definitions become private instance methods on Object, so you just need to initialize `obj` to *some* Ruby value.
cdg has joined #ruby
DTZUZU has joined #ruby
n008f4g_ has quit [Ping timeout: 264 seconds]
baweaver is now known as baweaver-mobile
cdg has quit [Remote host closed the connection]
benlovell has quit [Ping timeout: 244 seconds]
baweaver-mobile is now known as baweaver-home
baweaver-home is now known as baweaver
cdg has joined #ruby
n008f4g_ has joined #ruby
<Kimm>
obj=rb_str_new_cstr(""); // this is ok?
baweaver is now known as Ox0deb
<Kimm>
I still get the error
Spami_ has quit [Ping timeout: 260 seconds]
<Ox0deb>
Ox0dea: I'm one upping you
nando293921 has quit [Remote host closed the connection]
Ox0deb is now known as baweaver
dopamean_ has quit [Ping timeout: 264 seconds]
Spami_ has joined #ruby
andywojo has quit [Ping timeout: 260 seconds]
Snowy has joined #ruby
<Ox0dea>
Kimm: That has to happen after ruby_init().
<Kimm>
it does
Suntzu has quit [Read error: Connection reset by peer]
uglybandersnatch has quit [Ping timeout: 252 seconds]
mdw has quit [Quit: Sleeping Zzzzz]
djbkd has joined #ruby
baweaver has quit [Remote host closed the connection]
gregf has quit [Quit: WeeChat 1.4]
<smathy>
alsu, force_encoding just changes the encoding flag of the string, so "a utf-8 string".force_encoding("anything you like").force_encoding("utf-8") will always be valid, because you've not changed the string, just changed the encoding flag to something else, and then (back) to UTF-8.
djbkd_ has joined #ruby
<alsu>
smathy: but the enoding is valid, according to “valid_encoding?”
<alsu>
smathy: so why can’t the JSON serializer convert it?
<smathy>
alsu, right, because by the time you're calling that, you're calling it on a UTF-8 string.
<majuscule>
how can i force a hash to be created from a mapped array? aka, this_should_be_a_hash = [1,2].map do |i| Hash[ a => 1 ] end'
uglybandersnatch has joined #ruby
dopamean_ has joined #ruby
stunder has joined #ruby
<Radar>
majuscule: Mind chucking that code up on gist.github.com?
<smathy>
alsu, but, eg., if you do this then you'll see your error: "\xE0\xA4\xB8".force_encoding('windows-1252').encode("UTF-8")
jt__ has joined #ruby
<smathy>
Sorry, that first encoding should have been ASCII-8BIT
<alsu>
why can’t the json serializer encode binary data without trying to make UTF-8 out of it?
<eam>
alsu: because that's how json works
Acontius has quit [Quit: Connection closed for inactivity]
<eam>
json must be utf-8
<eam>
and yes, that means the json format fundamentally cannot represent some kinds of data in strings
_djbkd has quit [Remote host closed the connection]
<eam>
you can uuencode your strings to get around it
<alsu>
the *encoded* json must be utf-8. but it has escape sequences for byte values
ldnunes has quit [Quit: Leaving]
<eam>
nope, json strings must be valid utf-8
chihhsin has quit [Ping timeout: 260 seconds]
quazimodo has quit [Ping timeout: 246 seconds]
<smathy>
OMG, `File.binread(‘any.jpeg’).to_json` is what you were doing?!?!? Talk about a misleading presentation.
<alsu>
no, that’s not what I’m doing. but it demonstrates my question
jrafanie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<alsu>
I’m not sure exactly where this ruby dictionary is coming from that it has ASCII-8BIT fields. ultimately, a different JSON encoder from a different language. some part of the ruby JSON parser or the ruby YAML parser decided it must be binary data, not UTF-8
davedev24 has quit [Ping timeout: 248 seconds]
<alsu>
and turning it back into JSON is failing, which is absurb. it started as JSON
<smathy>
alsu, how long are you planning on going on without showing actual code here?
n008f4g_ has quit [Ping timeout: 248 seconds]
<alsu>
smathy: actually code won’t help. I need the original input string, which I don’t have
VeryBewitching has quit [Quit: Konversation terminated!]
diegoaguilar has joined #ruby
diegoaguilar has quit [Max SendQ exceeded]
davedev24 has joined #ruby
<smathy>
alsu, no idea what you mean by "decided it must be binary data" - all data is binary.
<alsu>
the code is effectively YAML.parse(JSON.parse(input).to_yaml).to_json
blackmesa has joined #ruby
<alsu>
smathy: I mean, the YAML encoded version says “binary”, and when parsed it makes an ASCII-8BIT string instead of a UTF-8 string
Azure has joined #ruby
rolha has joined #ruby
<alsu>
I don’t know why the YAML serializer thought it was binary. it doesn’t seem to make sense that JSON.parse would return anything as ASCII-8BIT, does it?
sorbo_ has joined #ruby
<smathy>
alsu, "says “binary”" sounds like my grandfather explaining how the computer told him he had a virus. Make a gist, show your problem with a small sample of data, demonstrate the issue, explain which method is returning the string "binary", etc.. Then we'll have some hope of helping.
<alsu>
smathy: yaml writes the word “binary” when encoding data. are you familiar with yaml?
davee_ has quit [Quit: Leaving]
johnmilton has quit [Remote host closed the connection]
sandstrom has quit [Quit: My computer has gone to sleep.]
<shortdudey123>
when i install the json rubygem 1.8.3, it installs the extentions to /usr/local but 1.7.3 installed them to /usr... that good? bad? indifferent? its causing problems for me trying to build the rubygems-json rpm
sorbo_ has quit [Ping timeout: 250 seconds]
n008f4g_ has joined #ruby
<shevy>
shortdudey123 have a look at "gem env" output, also if you have several different ruby versions and different gem versions, thing can become confusing
dopie has joined #ruby
<smathy>
shortdudey123, the gem doesn't decide where to install things, it's related to the location of the ruby you're running gem (or bundle) with.
daivyk has joined #ruby
<shortdudey123>
gem env points to /usr, using the sae ruby version (2.0), and 1.7.3 vs 1.8.3
Madplatypus has joined #ruby
bronson has joined #ruby
aupadhye has quit [Quit: Leaving]
djbkd has joined #ruby
<shortdudey123>
gem bin is at /usr/bin/gem
Azure has quit [Remote host closed the connection]
<shortdudey123>
gem env shows /usr first and /usr/local 2nd
<shortdudey123>
however, when doing rpmbuild, gem_extdir_mri is pointing to /usr and not /usr/local
ekinmur has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ramfjord_ has joined #ruby
<alsu>
bugs filed. apeiros, smathy, Radar: thanks for your help
baweaver has quit [Remote host closed the connection]
alsu has left #ruby [#ruby]
GitGud has joined #ruby
mistermocha has joined #ruby
<al2o3-cr>
so simple, just like an italian mama
Yiota has joined #ruby
<shevy>
lol
ramfjord has quit [Ping timeout: 250 seconds]
<smathy>
P4Titan, looks like an enum to me.
<P4Titan>
smathy: but I want to replace the contents in link_info
<P4Titan>
and even if I were to substitute the constants w/ an enum, it would still be clunky
misterm__ has joined #ruby
<Radar>
Are you saving this number to a database
<P4Titan>
yep
<Radar>
WTB question marks I have run out
<smathy>
P4Titan, no idea what constants you're talking about.
<Radar>
Why are you saving the number and not the string? Do you want to on-purpose confuse future developers?
<P4Titan>
1, 2, 0
mistermocha has quit [Read error: Connection reset by peer]
uglybandersnatch has joined #ruby
<Radar>
and you'll have a whole heap of link_info[:share_type] == 1 type code in your codebase too, which is just smellllllly
<Radar>
Source: done a ton of code reviews on apps that do exactly this and my god what dumpster fires.
<P4Titan>
Radar: ok, I'll replace the bare numbers w/ an enum
d0nn1e has quit [Ping timeout: 244 seconds]
jdawgaz has joined #ruby
<P4Titan>
but why should I contain the entire string when I only need some representation of it
<P4Titan>
the string bears on more meaning that an enum
<P4Titan>
yet is bigger, slower, etc.
<smathy>
Bigger?!?!
<P4Titan>
I simply wish to condense my case statement to something more elegant/clever
* Radar
is boggling over here
krz has joined #ruby
<Radar>
P4Titan: I have a tip for condensing it: don't write a case statement when you don't need one.
<Radar>
P4Titan: 0 lines of code, 0 bugs.
<Radar>
Store the string in the DB
<P4Titan>
Tho may u give me a reason as to why?
<Radar>
[10:12:22] <Radar>Source: done a ton of code reviews on apps that do exactly this and my god what dumpster fires.
<smathy>
What do you think we're writing here? The head move routines for a hard drive?
<Radar>
You will make life hard for future-you and future-other-people.
Dimik has joined #ruby
d0nn1e has joined #ruby
<Radar>
You need to make it EXPLICIT in your codebase that when the share_type is "network" it really means "network"
<smathy>
P4Titan, your reason, "bigger, slower" is absurd - that's our reason for picking the option that is easier to implement and understand.
<Radar>
becuase nobody knows that 1 == "network" unless they've really looked hard into the problem before.
spider-mario has quit [Remote host closed the connection]
FooMunki has quit [Quit: FooMunki]
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
FooMunki has joined #ruby
rbennacer has quit [Remote host closed the connection]
<shevy>
he wants a tiny database!
Snowy has quit [Remote host closed the connection]
<P4Titan>
I just feel that the marginal benefit of a more readable database doesn't convince me
djbkd has quit [Remote host closed the connection]
djbkd has joined #ruby
jackjackdripper has quit [Ping timeout: 244 seconds]
<Radar>
P4Titan: A smaller database doesn't convince me.
jackjackdripper has joined #ruby
<P4Titan>
I will see if I can store enums in an Active Records databse
<Radar>
oh wow you get a 0.0000000001 optimisation
<Radar>
amazing
KensoDev has joined #ruby
Balzrael has quit [Remote host closed the connection]
<P4Titan>
Radar: I fear your sarcasm does not impact *my* project. Moreover, I simply wish to learn some Ruby posing an interesting question which surely can be simplied in some clever manner, tickling ur inner rubyist brains.
<Radar>
ok, glhf bye
<smathy>
P4Titan, comprehensible, explicit values are not a marginal benefit, but no one's going to stop you, but we're the wrong people to ask for opinions on shitty workarounds to bad choices.
uglybandersnatch has quit [Ping timeout: 252 seconds]
<smathy>
P4Titan, and while you're at it, you should definitely switch away from ruby if the slowness of using strings bothers you.
jackjackdripper has quit [Client Quit]
jackjackdripper has joined #ruby
<P4Titan>
I would say that my general mentaility (for this project at least) is: if it can be better, why not make it better.
<P4Titan>
Anyway, I appreciate your input and will take it into future consideration.
Cohedrin_ has joined #ruby
Cohedrin has quit [Ping timeout: 244 seconds]
Ormm has joined #ruby
FooMunki has quit [Quit: FooMunki]
astrobun_ has quit [Read error: Connection reset by peer]
vikaton has quit [Quit: Connection closed for inactivity]
early90spants has joined #ruby
GodFather has joined #ruby
pawnbox has joined #ruby
astrobunny has joined #ruby
saneax_AFK is now known as saneax
ChiefAlexander has quit [Quit: Leaving...]
yosafbridge has quit [K-Lined]
Yiota has joined #ruby
uglybandersnatch has joined #ruby
QualityAddict has quit [Quit: Konversation terminated!]
baweaver has joined #ruby
<rehat>
so lost, I am reading a file of words into an array but for some reason I can't find the index of a string that is in the array. '==' doesn't seem to work
<rehat>
I tried just array_var.index("bat") but that returned nothing
<Canar>
watching you ruby pros answer newbie questions has honestly advanced my ruby understanding so much... i haven't ever joined an irc channel that improved my understanding quite so much
pawnbox has quit [Ping timeout: 276 seconds]
<havenwood>
rehat: Then you're batless.
<Ox0dea>
rehat: Needs more bat.
<havenwood>
Canar: :D
<Ox0dea>
Or else you forgot to #chomp your lines.
<havenwood>
rehat: Check: array_var.grep /bat/
klka has quit []
<havenwood>
rehat: Or just sanity check: p array_var
<dostoyevsky>
hmmmm... there is no unicode symbol for batman... how are you supposed to call him when you need him?
<dostoyevsky>
with a jpg?
<rehat>
do I need to do anything special with strings read from a file? I printed out the .class and is say String and there are no '\n' or '\r' in the puts. I made another array and hard coded the strings and index("bat") worked
DLSteve has joined #ruby
finisherr has left #ruby [#ruby]
<Canar>
dostoyevsky: .svg so you don't get artefacting from scaling the symbol up to be 2 miles wide
mdelgadonyc has left #ruby ["Leaving"]
<baweaver>
files have newlines
<Ox0dea>
rehat: `puts` will conceal line endings from you; use `p` for debug printing.