<samgerber>
hanmac: I think it used to...between 1.8.7 and 2.0.0. I guess it seems odd to me that Array#count would operate in constant time while Hash and Set #count are relegated to linear time. (all this assuming no argument or block is passed)
lessless has joined #ruby
<hanmac>
samgerber: if you want size then use it ... specially Enumerator also has a #size method
<clorisu>
thanks forcer ill read it and get back to you
chouhoulis has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
firstdayonthejob has joined #ruby
<samgerber>
hanmac: thank you. I think I understand. What I'm looking to learn is a case when it would be useful to have a count method that traverses the collection even when no block or argument is given.
<forcer>
So I'm curious. Class#method seems a common way of referencing methods in a class, but that's not Ruby syntax. Where did that syntax come from? :-)
chouhoulis has quit [Ping timeout: 250 seconds]
<hanmac>
forcer: because Class.method is ambiguous
yardenbar has joined #ruby
<forcer>
hanmac: That would be a class method, right?
<hanmac>
forcer: hm yes and no, because if you do: "ri File.size" it will show you both instance and class method
<forcer>
hanmac: Ah! Well, it would at least *also* refer to class methods. Do you know where the # syntax came from? Or is that just something that was used and stuck around?
<Ox0dea>
forcer: But yes, `Foo.bar` is the orthography used for class methods. You'll see `Foo::bar` sometimes used as well, but that's better reserved for constants.
<Ox0dea>
I'm reasonably certain Foo#bar is just a convention that managed to stick.
<hanmac>
Ox0dea: thats the prob Foo::bar is a method, Foo::Bar is a constant, but Foo::Bar() is a method too ;P
<forcer>
:-)
<forcer>
hanmac, Ox0dea: Thank you!
<Ox0dea>
Sure thing.
<Ox0dea>
samgerber: Never.
<Ox0dea>
But why special-case #count when #size is already available?
Guest34101 has joined #ruby
onechr has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
marr has joined #ruby
bakedb has quit [Ping timeout: 248 seconds]
arup_r has left #ruby [#ruby]
<samgerber>
Ox0dea: Consistency, I suppose. Array#count defers to #length and #size when no argument is given. Why isn't there a Hash#count that does the same thing? This isn't an attack, or anything, just curiosity. It seems like the behavior was implemented at one point and then was removed, so I was wondering what issues it had caused.
Guest9744 has left #ruby ["WeeChat 0.4.2"]
<forcer>
They probably started to wonder if they need all of #count, #count_pair, #count_key and #count_value, and then thought meh, never mind.
<Ox0dea>
samgerber: I grant that it's inconsistent, but specializing various Enumerable methods for all the classes that include Enumerable is a slippery slope.
<samgerber>
Ox0dea: Ah, thanks, sorry, I'm a bit new to all of this. These are methods that are defined in Enumerable and then over-ridden in Hash, right?
<Ox0dea>
samgerber: That's right.
PedramT has joined #ruby
Chagel has joined #ruby
<Ox0dea>
1.9.3 is when Array#count got specialized, but I don't see anything specific to Hash in the change logs.
rmulligan has quit [Ping timeout: 248 seconds]
<Ox0dea>
And I imagine that only happened because so many people were using it incorrectly. :/
PedramT has quit [Read error: Connection reset by peer]
<samgerber>
and then saw that the documentation says this: "...where size is called if it responds to it..." and then when I was looking at future versions, I just looked at documentation without again checking the source
<samgerber>
so I think I'm all off on when I think changes happened
dgncn has quit [Excess Flood]
<samgerber>
It looks like 1.9.2 is where the attempt to call size was removed, but the documentation wasn't updated at that time?
<clorisu>
also Ox0dea and hanmac : why the # before the method? does it signify something?
DoubleMalt has joined #ruby
<Ox0dea>
clorisu: It's used to signify "instance method".
LoneHermit has quit [Ping timeout: 252 seconds]
<clorisu>
ah
<Ox0dea>
File.size and File#size are different methods and we need a way to distinguish between them.
n008f4g_ has joined #ruby
<samgerber>
hanmac Ox0dea: thanks a bunch. You have both given me a lot to think about and a new resource for learning about the history of ruby! (bugs.ruby-lang.org). I really appreciate both of your time and everyone else putting up with my spam.
merida_ has quit [Remote host closed the connection]
<Ox0dea>
samgerber: Any time, especially if this is the standard quality of your "spam". :P
bezhermoso has joined #ruby
merida_ has joined #ruby
<hanmac>
clorisu: for array:
<hanmac>
#each: might change the objects, keep the array intact
<hanmac>
#map: mostly does not change the objects, return a new array with or without new objects
<hanmac>
#map!: does replace the objects with new ones, does not change the array
skade has quit [Quit: Computer has gone to sleep.]
rmulligan has quit [Ping timeout: 250 seconds]
bronson has quit [Ping timeout: 252 seconds]
slackbotgz has joined #ruby
Suntzu has quit [Read error: Connection reset by peer]
ltd_ has quit [Ping timeout: 244 seconds]
ltd has joined #ruby
Silox| has joined #ruby
tvw has joined #ruby
BrunoSaboia has joined #ruby
marsjaninzmarsa has quit [Quit: ZNC 1.7.x-git-487-cbf5c38 - http://znc.in]
Guest34101 has quit [Ping timeout: 276 seconds]
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
skade has joined #ruby
BSaboia has quit [Ping timeout: 244 seconds]
millerti has joined #ruby
marsjaninzmarsa has joined #ruby
tristanp has joined #ruby
bricker has joined #ruby
TomyLobo has joined #ruby
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
millerti has joined #ruby
tristanp has quit [Ping timeout: 264 seconds]
BrunoSaboia has quit [Ping timeout: 244 seconds]
bricker has quit [Ping timeout: 248 seconds]
matp_ is now known as matp
nennes has joined #ruby
nerium has quit [Quit: nerium]
nennes has quit [Client Quit]
weemsledeux has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
chouhoulis has joined #ruby
stannard has joined #ruby
nerium has joined #ruby
chouhoulis has quit [Ping timeout: 260 seconds]
stannard_ has joined #ruby
Suntzu has joined #ruby
stannard has quit [Ping timeout: 250 seconds]
hotpancakes has joined #ruby
lkba has joined #ruby
thegunbuster has joined #ruby
evidex has joined #ruby
jdawgaz has joined #ruby
p0p0pr37 has quit [Ping timeout: 240 seconds]
hotpancakes has quit [Ping timeout: 248 seconds]
slackbotgz has quit [Remote host closed the connection]
SCHAAP137 has quit [Quit: Leaving]
tk___ has joined #ruby
skweek has quit [Ping timeout: 244 seconds]
nerium has quit [Quit: nerium]
tvw has quit [Remote host closed the connection]
mistermocha has joined #ruby
nerium has joined #ruby
mistermocha has quit [Ping timeout: 248 seconds]
frustrum has joined #ruby
CloCkWeRX has quit [Quit: Leaving.]
rmulligan has joined #ruby
triangles has quit [Quit: Leaving]
tjohnson has quit [Quit: Connection closed for inactivity]
frustrum has quit [Ping timeout: 248 seconds]
DmitryBochkarev has quit [Quit: Leaving]
moeabdol has quit [Ping timeout: 246 seconds]
rmulligan has quit [Ping timeout: 264 seconds]
baweaver has joined #ruby
xue has quit [Ping timeout: 252 seconds]
houhouli_ has quit [Remote host closed the connection]
codecop_ has joined #ruby
baweaver has quit [Ping timeout: 276 seconds]
Gasher has joined #ruby
charlemagne has joined #ruby
tonyynot has joined #ruby
DoubleMalt has quit [Remote host closed the connection]
cd-rum has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
intrigueD has quit [Remote host closed the connection]
hotpancakes has joined #ruby
binaryplease has joined #ruby
xue has joined #ruby
charlema_ has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
charlemagne has quit [Ping timeout: 248 seconds]
hotpancakes has quit [Ping timeout: 260 seconds]
binaryplease has quit [Quit: WeeChat 1.4]
charlema_ has quit [Ping timeout: 268 seconds]
RedNifre has joined #ruby
the_drow has quit [Quit: This computer has gone to sleep]
<RedNifre>
Heya. I'm not quite clear on the "falsiness" of nil. I wanted to check two variables for not nil so I did if(a && b)... that works, but I get a "string used in condition" warning. Is there a better way to do this?
<RedNifre>
...or should I write the conventional if((a != nil) && (b != nil)) ?
pestilence has joined #ruby
Tempesta has quit [Quit: AdiIRC is updating to v2.3 Beta Build (2016/03/20) 32 Bit]
warprobot has joined #ruby
warprobot has left #ruby [#ruby]
Tempesta has joined #ruby
<pestilence>
I would like to put a ruby script into the bin directory of a gem so that you can run it from the command line post-gem install
<pestilence>
is it possible to do this in a cross-platform manner?
<pestilence>
i.e. I would like it to work on both windows and linux
bricker has joined #ruby
yeticry has quit [Ping timeout: 260 seconds]
chouhoulis has joined #ruby
yeticry has joined #ruby
<n1colas>
Hello
the_drow has joined #ruby
Azure has quit [Remote host closed the connection]
mtkd has joined #ruby
chouhoulis has quit [Ping timeout: 246 seconds]
<Papierkorb>
RedNifre: What's the exact code you're trying? That warning only appears for me (as expected) when I use string literals in the condition, not with string variables
skade has joined #ruby
warprobot has joined #ruby
<Papierkorb>
RedNifre: (a && b) is fine, if you really want to test for nil use #nil?
evidex has quit [Ping timeout: 260 seconds]
warprobot has quit [Remote host closed the connection]
warprobot has joined #ruby
idletask has quit [Ping timeout: 240 seconds]
warprobot has left #ruby [#ruby]
idle_task has joined #ruby
<RedNifre>
Papierkorb the actual code uses first,second = ARGV, I got the warning when I tested if(nil && "bla") in the REPL.
<Papierkorb>
RedNifre: then your test is the issue, the code works fine
<apeiros>
ruby knows that && "blah" is pointless and tells you so
freerobby has joined #ruby
Snowy has joined #ruby
<RedNifre>
Makes sense, thanks.
evidex has joined #ruby
<djellemah>
>> a = "string"; b = "condition"; if a && b then :yes else :no end # RedNifre, although then is just for the single-line
edwinvdgraaf has quit [Read error: Connection reset by peer]
edwinvdg_ has joined #ruby
mistermocha has quit [Ping timeout: 252 seconds]
rmulligan has quit [Ping timeout: 248 seconds]
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
intrigueD has joined #ruby
Snowy has quit [Remote host closed the connection]
houhoulis has joined #ruby
Chagel has quit [Ping timeout: 248 seconds]
blandflakes has joined #ruby
dcunit3d has joined #ruby
pestilence has quit [Quit: leaving]
tildes has quit [Ping timeout: 244 seconds]
pestilence has joined #ruby
pestilence has quit [Changing host]
pestilence has joined #ruby
tk___ has quit [Quit: ばいばい]
the_drow has quit [Quit: This computer has gone to sleep]
biberu has joined #ruby
Ropeney has quit [Quit: Leaving]
<djellemah>
Is there a way to get the same value as ::Kernel.raise(*args) rescue $! but without the rescue? TIA
<apeiros>
djellemah: what are you trying to achieve by that?
<apeiros>
?xy
<ruby[bot]>
it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
<pestilence>
is there a way to change what happens during gem installation based on the platform? maybe have it install one bin if you're on windows and one bin if you're on linux?
<apeiros>
pestilence: not using windows, so I can't verify. but as far as I understood it - if ruby is properly installed on windows, then executables from gems will just work (assuming they scripts themselves don't have platform dependent stuff in it)
stannard_ has quit [Ping timeout: 248 seconds]
<pestilence>
apeiros: ok
<djellemah>
apeiros: I'll take that as "I don't know of a way" :-p
<apeiros>
djellemah: that'd be stupid. but you're free to not answer follow up questions.
tristanp has joined #ruby
<djellemah>
Why would it be stupid?
hightower4 has quit [Remote host closed the connection]
bricker has quit [Ping timeout: 244 seconds]
<apeiros>
djellemah: I'm not interested in a meta discussion. want a solution? answer the question. otherwise: good luck.
_djbkd has joined #ruby
rkazak has joined #ruby
freerobby1 has joined #ruby
freerobby has quit [Ping timeout: 260 seconds]
<djellemah>
Think about it for a while, you might find that all the information a potential answerer needs is already in the question. Thanks anyway ;-)
Karix has joined #ruby
<apeiros>
ok, seems you're more interested in pissing off potential helpers than actually getting help.
<apeiros>
welcome in my /ignore
Karix has quit [Client Quit]
tristanp has quit [Ping timeout: 240 seconds]
evidex has quit [Remote host closed the connection]
merida___ has quit [Ping timeout: 244 seconds]
merida__ has quit [Ping timeout: 244 seconds]
_djbkd has quit [Ping timeout: 268 seconds]
jaruga has joined #ruby
jaruga is now known as jaruga_
oliver__ has quit [Remote host closed the connection]
hotpancakes has quit [Remote host closed the connection]
<havenwood>
I could probably port over the changes from the NPM version despite how bad I am at C. :O
<havenwood>
Somebody else do it! ;)
<havenwood>
It's a nice gem.
<havenwood>
I kinda expected that one to make it into the Ruby stdlib but instead it's unmaintained.
fedexo has joined #ruby
<djellemah_>
havenwood: digressing slightly: do you know of a fast stable digest for non-cryptographic purposes? The closest I could find was xxhash, but I need something that also works with jruby.
<surial>
I have a question related to ruby and a gem itself, not the language. Is this the right place?
Vingador has quit [Ping timeout: 244 seconds]
RegulationD has quit [Ping timeout: 264 seconds]
<surial>
(Specifically, mac os x and ruby from homebrew, gem install gtk2, and a factor 10,000% slowness).
Karix has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<apeiros>
morfin: the proc created by Symbol#to_proc does
<apeiros>
surial: yeah, just ask
<surial>
Okay. I ran 'gem install gtk2' which seems like it works but it does not. I then ran sudo gem install gtk2 and this works, but then when I start a gtk2-using app, ruby slows down.. a lot. As in, CTRL+C takes 3 minutes (!!) to process just to shut down ruby.
<surial>
(as does sending a normal sigkill).
<apeiros>
"but it does not" - how do you figure?
<surial>
sigterm works fine, and the CPU is not going haywire.
<surial>
apeiros: gtk2 bindings fail to load.
<shevy>
surial I have no delay using ctrl-c when I use ruby-gtk programs
<surial>
Right. So, something is messed up with the installation. All I did was brew install ruby / gem install gtk2 / run a ruby gtk app.
<shevy>
I use linux though
<surial>
I also get a warning from gtk about missing locales.
LoneHerm_ has quit [Read error: Connection reset by peer]
<surial>
Yeah, on linux this would have been easier.
<surial>
I have a little ruby experience, but not with GTK2, and this isn't my app. Possibly I'm in the wrong channel.
<shevy>
you may have to try to find someone who uses osx too, to try that example
TheCubeLord has joined #ruby
<shevy>
I myself tend to install the gtk/gnome bindings differently. I use https://sourceforge.net/projects/ruby-gnome2/files/ruby-gnome2/ latest variant always, extract it, then batch-install the components of the subdirectories in that extracted directory
<surial>
Still pretty slow.
scepticulous has quit [Ping timeout: 276 seconds]
<surial>
As in, CTRL+C takes about 10 seconds to process.
<surial>
also, I gem unisntalled.. and it still works. so, how the heck is that possible.
elifoster has joined #ruby
<surial>
oh, nevermind. It kinda worked but then failed when trying to write docs.
scepticulous has joined #ruby
<surial>
Yeah, it's happening. This is idiotically slow. As in, 20seconds + complete frozen.
_stu_ has quit [Quit: _stu_]
jaequery has joined #ruby
<shevy>
sounds as if something blocks the main glib loop
<surial>
Yes, and it's not the ruby code. Hmm..
<surial>
I'm gonna try a reboot just in case.
Vingador has joined #ruby
<shevy>
we may have to find another heroic osx user :)
intrigueD has quit [Read error: Connection reset by peer]
intrigueD has joined #ruby
tildes has joined #ruby
jgt has joined #ruby
arup_r has joined #ruby
codecop has joined #ruby
<arup_r>
Hi.. I am writing a code. Where I can't sort the random numbers array before hand. I have to output in sorted order through. I did, https://gist.github.com/aruprakshit/7a4a13be1a6f84df4b99#file-histogram-rb-L9. But making a Hash, then sorting it, and then converting back to Hash looks overkill. What is the better way?
<surial>
reboot did not help.
nofxx has quit [Ping timeout: 240 seconds]
nofxx has joined #ruby
benzrf_irssi has joined #ruby
<benzrf_irssi>
hey!
edwinvdgraaf has joined #ruby
<benzrf_irssi>
is chruby still preferred for multi-impl ruby stuff?
Suntzu has quit [Read error: Connection reset by peer]
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
frustrum has joined #ruby
tildes has quit [Ping timeout: 246 seconds]
edwinvdgraaf has quit [Read error: Connection reset by peer]
<apeiros>
arup_r: in your example, the to_h is unnecessary
<apeiros>
benzrf_irssi: chruby is still considered to be a good choice
<shevy>
benzrf_irssi !!! you are BACK!!!!!!!
edwinvdgraaf has joined #ruby
Xeago has joined #ruby
<benzrf_irssi>
hmm
<benzrf_irssi>
sup shevy
infernix has quit [Remote host closed the connection]
<benzrf_irssi>
i have mixed feelings about ruby these days :}
<shevy>
you were gone like 10 years!
<benzrf_irssi>
but i'm looking into gsoc with celluloid
<benzrf_irssi>
shevy: more like 2-3 :]
IanMalcolm has quit [Quit: ZNC 1.6.1 - http://znc.in]
<shevy>
I wasn't so quite off :D
IanMalcolm has joined #ruby
<shevy>
you settled for haskell?
<arup_r>
apeiros: sort_by breaks Hash to Array..
<arup_r>
Oh I see
<arup_r>
what you meant
<benzrf_irssi>
looks i stopped idling in #ruby on 2014-12-19
<apeiros>
yes, if you actually want a hash back after sort, you need to_h.
<benzrf_irssi>
so about a year and a half ago
bronson has joined #ruby
<benzrf_irssi>
shevy: actually i hadn't been programming so much up until fairly recently
dionysus69 has joined #ruby
frustrum has quit [Ping timeout: 246 seconds]
IanMalcolm has quit [Client Quit]
<benzrf_irssi>
doing more math
IanMalcolm has joined #ruby
<surial>
Downgraded to GTK2 2.2.5. Same problem, but now killing it eventually leads to this: [BUG] pthread_mutex_unlock: Invalid argument (EINVAL)
<arup_r>
nah, hash I needed to count frequency, so I no need any more it. thanks apeiros
<benzrf_irssi>
since a month or two ago ive been getting back into doing more programming but mostly in python and a little bit of javascript
<benzrf_irssi>
:>
IanMalcolm has quit [Client Quit]
<surial>
and it then tries to tell me where to find the crash log. The thing that tries to tell me where the crash log is.. crashed.
<benzrf_irssi>
(haskell is still best though)
<surial>
Boy, I don't know who maintains these, but clearly this is more of a hobby than a job for em huh.
IanMalcolm has joined #ruby
benzrf has joined #ruby
IanMalcolm has quit [Client Quit]
IanMalcolm has joined #ruby
ruurd has joined #ruby
pelegreno has quit [Remote host closed the connection]
ruurd is now known as Guest60834
<shevy>
surial I think they all use linux ;)
<surial>
yeah :/
Xeago has quit [Remote host closed the connection]
<benzrf_irssi>
shevy: what do you use, windows?
<benzrf_irssi>
* surial
infernix has joined #ruby
uglybandersnatch has quit [Ping timeout: 276 seconds]
bronson has quit [Ping timeout: 252 seconds]
Xeago has joined #ruby
<benzrf_irssi>
does anybody know,
gbgdev_ has joined #ruby
<benzrf_irssi>
if i install rubies using my package manager (on Arch), will that work with chruby
jaequery has joined #ruby
<benzrf_irssi>
or should i get ruby-install
rmulligan has joined #ruby
gbgdev has quit [Ping timeout: 260 seconds]
pelegreno has joined #ruby
nando293921 has quit [Ping timeout: 240 seconds]
yqt has quit [Ping timeout: 264 seconds]
Xeago has quit [Read error: Connection reset by peer]
<arup_r>
I am trying to understand the difference between rand(10) and rand(srand(10)) I see srand version gives always same numbers,, how it rand works with srand to produce same output multiple times? https://gist.github.com/aruprakshit/7a4a13be1a6f84df4b99
hotpanca_ has joined #ruby
BDA has quit [Remote host closed the connection]
<apeiros>
somebody calling rand(srand(10)) seems to be somebody who doesn't know what they're doing.
hotpancakes has quit [Remote host closed the connection]
<shevy>
looks like php code!
<apeiros>
you only call srand when you want to ensure a repeatable series of numbers from rand()
nerium has joined #ruby
<apeiros>
and its return value is the old seed, which makes it rather unsuitable as input for rand()
circ-user-woeWP has joined #ruby
circ-user-woeWP has quit [Remote host closed the connection]
elifoster has quit [Ping timeout: 244 seconds]
<arup_r>
ok.. so.. if I use srand with rand, it will give me the same number all the time.. the number can be any number.. I am confused because in each turn it gives 9,9.. and then when I changed the seed always 8..
baweaver has joined #ruby
<arup_r>
apeiros: what do you mean by old seed?
<apeiros>
arup_r: I suggest you read the docs of srand and rand. all I'd do is repeat them.
fullofcaffeine has quit [Remote host closed the connection]
<rubyx9>
this dang course man
<rubyx9>
its weird
<Mattx>
yeah, not sure if it's the same. because I'm passing that to a function that expect a block
<Mattx>
I'll check anyway
Gasher has joined #ruby
diegoviola has joined #ruby
mallu has joined #ruby
<adaedra>
Mattx: blocks are just an application case of procs. You can, with the thing above, then call a method waiting for a block with something like method(&callbacks[:success])
rrrepsaj has quit [Remote host closed the connection]
<al2o3-cr>
speed.between?(40,60) ? false : true
<mtkd>
nice, didn't know about between
francesc has joined #ruby
<rubyx9>
al203-cr: yes that works
<rubyx9>
hehe
diego1 has joined #ruby
<rubyx9>
thanks
TheCubeLord_ has quit [Client Quit]
LoneHermit has joined #ruby
diegoviola has quit [Ping timeout: 276 seconds]
blandflakes has joined #ruby
dcunit3d has quit [Ping timeout: 244 seconds]
codecop has quit [Remote host closed the connection]
LoneHermit has quit [Ping timeout: 252 seconds]
fedexo has quit [Ping timeout: 240 seconds]
theRealGent has joined #ruby
b|ackwolf has quit [Ping timeout: 264 seconds]
SenpaiSilver has quit [Read error: Connection reset by peer]
SenpaiSilver has joined #ruby
lianj has quit [Ping timeout: 276 seconds]
lkba has quit [Ping timeout: 240 seconds]
Disavowed has joined #ruby
Mattx has quit [Quit: Leaving]
lkba has joined #ruby
chouhoulis has joined #ruby
pawnbox has quit [Remote host closed the connection]
LoneHerm_ has joined #ruby
jaruga_ has quit [Quit: jaruga_]
i8igmac has joined #ruby
Gasher has joined #ruby
lianj has joined #ruby
lianj has joined #ruby
havenwood has quit [Remote host closed the connection]
chouhoulis has quit [Ping timeout: 244 seconds]
Musashi007 has quit [Quit: Musashi007]
Musashi007 has joined #ruby
bronson has joined #ruby
diego1 has quit [Changing host]
diego1 has joined #ruby
diego1 is now known as diegoviola
Musashi007 has quit [Client Quit]
fullofcaffeine has joined #ruby
bronson has quit [Ping timeout: 252 seconds]
warprobot has joined #ruby
warprobot has quit [Remote host closed the connection]
mtkd has quit [Ping timeout: 248 seconds]
bluOxigen has quit [Ping timeout: 276 seconds]
fullofca_ has joined #ruby
mtkd has joined #ruby
Spami has quit [Quit: This computer has gone to sleep]
bezhermoso has quit [Quit: Zzzzz...]
fullofc__ has joined #ruby
mdw_ has joined #ruby
mdw has quit [Ping timeout: 244 seconds]
nofxx has quit [Ping timeout: 248 seconds]
fullofcaffeine has quit [Ping timeout: 264 seconds]
nofxx has joined #ruby
Yzguy has joined #ruby
mdw has joined #ruby
mdw__ has joined #ruby
moeabdol has joined #ruby
fullofcaffeine has joined #ruby
fullofca_ has quit [Ping timeout: 260 seconds]
yfeldblum has joined #ruby
FooMunki has joined #ruby
mdw_ has quit [Ping timeout: 276 seconds]
diegoviola has quit [Read error: Connection reset by peer]
diego1 has joined #ruby
norc_ has quit [Ping timeout: 260 seconds]
mdw has quit [Ping timeout: 240 seconds]
LoneHerm_ has quit [Read error: Connection reset by peer]
LoneHerm_ has joined #ruby
moeabdol1 has joined #ruby
fullofc__ has quit [Ping timeout: 264 seconds]
Spami has joined #ruby
cHolthi has joined #ruby
moeabdol has quit [Ping timeout: 248 seconds]
rikkipitt has joined #ruby
diego2 has joined #ruby
cHolthi1 has joined #ruby
baweaver has joined #ruby
LoneHerm_ has quit [Remote host closed the connection]
<mallu>
Can someone please tell me the correct regex for replace this AMI id in this line "ImageId" : "ami-1ec6257e"
cHolthi has quit [Ping timeout: 246 seconds]
cHolthi has joined #ruby
diego1 has quit [Ping timeout: 252 seconds]
<apeiros>
mallu: I see "ami" in there, no "AMI". you mean that? or why the lapse in casing?
TheCubeLord has quit [Quit: Leaving]
diego3 has joined #ruby
sneakerhax has quit [Quit: back later]
sneakerhax has joined #ruby
cHolthi1 has quit [Ping timeout: 246 seconds]
<mallu>
apeiros: I want to replace that to "ImageId" : "aim-new"
<apeiros>
your notation is confusing.
<apeiros>
is '"ImageId" : "ami-1ec6257e"' as a whole a string?
<apeiros>
or are you showing us part of a hash? or what?
<mallu>
apeiros: I have json file and one of the line is "ImageId" : "ami-1ec6257e" I want to search for that line and change it to "ImageId" : "ami-something"
diego2 has quit [Ping timeout: 276 seconds]
FooMunki has quit [Read error: Connection reset by peer]
<apeiros>
IMO you should parse the json then, and not use a regex on the serialization
<apeiros>
gsub(/ami-[^"]*"/, "ami-new")
baweaver has quit [Ping timeout: 250 seconds]
TheCubeLord has joined #ruby
<mallu>
apeiros: ok thanks
rikkipitt has quit [Quit: Leaving...]
tjohnson has joined #ruby
jpfuentes2 has joined #ruby
cHolthi1 has joined #ruby
yqt has joined #ruby
cHolthi has quit [Ping timeout: 240 seconds]
mleung has joined #ruby
mleung has quit [Client Quit]
Spami has quit [Quit: This computer has gone to sleep]
mleung has joined #ruby
RedNifre has left #ruby ["WeeChat 0.4.2"]
<mallu>
apeiros: I am getting this "ImageId" : "aim-new. Missing " after new
diego3 has quit [Changing host]
diego3 has joined #ruby
diego3 is now known as diegoviola
cHolthi1 has quit [Ping timeout: 244 seconds]
cHolthi has joined #ruby
<apeiros>
mallu: aaaand did you try to fix that?
<mallu>
apeiros: can you please explain this to me [^"]*"
<jidar>
not quotes
<apeiros>
[^] is a negated character class. so [^"] means "any character except a quote"
<apeiros>
* means zero-or-more
<mallu>
apeiros: ok thanks
matp has quit [Remote host closed the connection]
ready has quit [Ping timeout: 240 seconds]
<mallu>
apeiros: this will add trailing "? (/ami-[^"]*"/, "ami-new\"")
cHolthi has quit [Ping timeout: 244 seconds]
Spami has joined #ruby
cHolthi has joined #ruby
vdamewood has joined #ruby
dcunit3d has joined #ruby
nando293921 has quit [Quit: Lost terminal]
Riviera- has joined #ruby
yqt has quit [Ping timeout: 276 seconds]
Dreamer3_ has quit [Quit: Computer has gone to sleep.]
skade has quit [Quit: Computer has gone to sleep.]
cd-rum has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cd-rum has joined #ruby
skade has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
roshanavand has quit [Quit: This computer has gone to sleep]
roshanavand has joined #ruby
the_drow has joined #ruby
cHolthi has quit [Ping timeout: 276 seconds]
Marsupermammal has joined #ruby
spacedev has joined #ruby
<spacedev>
hi
chouhoulis has joined #ruby
<spacedev>
i have installed cocoapods with "sudo gem install cocoapods", but when I "pod init" command, zsh return me command not found
griffindy has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<spacedev>
i running with ZSH
Sucks has joined #ruby
the_drow has quit [Client Quit]
<shevy>
spacedev you must have installed ruby in a strange way right?
<spacedev>
no ?
<shevy>
it must be
diegoviola has quit [Quit: WeeChat 1.4]
<spacedev>
maybe its a path issue
<spacedev>
im using zsh
<shevy>
cocoapods has two executables in bin/ which is bin/pod and bin/sandbox-pod
<shevy>
so you can not have a ruby that has the /usr prefix OR you must use something that installs in some other directory
uglybandersnatch has quit [Ping timeout: 248 seconds]
<shevy>
so yeah you installed ruby in a strange way - rbenv :)
PaulCape_ has joined #ruby
blt has joined #ruby
<spacedev>
so what ?
<shevy>
I am not sure what rbenv recommends to have bin/ files work as-is
Jesperhead has joined #ruby
<spacedev>
im totally lost$
uglybandersnatch has joined #ruby
zacstewart has quit [Read error: Connection reset by peer]
<shevy>
it should be either in /Users/kirgansomville/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0 or in /Users/kirgansomville/.gem/ruby/2.1.0
intrigueD has joined #ruby
<shevy>
just find where the "pod" executable is there, you can then either add it to a $PATH or provide a symlink to it but I am sure that rbenv has some way too so you might find that in its documentation
PaulCapestany has quit [Ping timeout: 244 seconds]
mhoungbo has quit [Remote host closed the connection]
* TheCubeLord
i have to relog
<Jesperhead>
hey all, helping a friend get genieacs up and running on their home machine. They seem to be having problems which look *very* similar to https://github.com/flori/json/issues/229. I attempted to follow Anatol's comment (jan 5th, 2015) and replaced line 175 in /ext/fbuffer/fbuffer.h to include the second argument. Attempting to install still yields the same error. im very new to ruby/gem...
<Jesperhead>
...installer and friend even less so. do we need to compile the gem manually?
TheCubeLord has quit [Quit: Leaving]
TheCubeLord has joined #ruby
biberu has quit [Read error: Connection reset by peer]
Marsupermammal has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Jesperhead>
shevy: thanks for you earlier input and forgive my smarmy-ness. we're gonna shelve the issue for today. maybe we can get it working in the coming weeks
Mattx has joined #ruby
bricker has quit [Ping timeout: 250 seconds]
nerium has joined #ruby
RegulationD has quit [Ping timeout: 248 seconds]
<Mattx>
Is there a way to stop the interpreter exactly when the exception occurs? It would be really time saving. For instance if I do foo/bar and bar=0, I want to stop the code right there before it throw the exception so I check what's wrong, instead of adding a "debugger" line and running the code again. Possible?
<Radar>
Mattx: No. Put a debugger.
<darix>
Mattx: there is a pry wrapper that will catch any exception
<Mattx>
that's what I'm doing, but it takes a lot of time and effort
<Mattx>
because I'm developing a tool that takes random rows from the DB and process them, but sometimes it crashes, and it's hard to reproduce the error
wilbert has joined #ruby
edwinvdgraaf has quit [Remote host closed the connection]
vikaton has quit [Quit: Connection closed for inactivity]
marr has joined #ruby
cHolthi1 has joined #ruby
blackmesa has joined #ruby
cpup has joined #ruby
Aviio has quit [Remote host closed the connection]
cHolthi has quit [Ping timeout: 276 seconds]
sesquipedalian has joined #ruby
<Mattx>
darix, seriously awesome, thanks!
cHolthi has joined #ruby
ss_much has joined #ruby
BtcBen has joined #ruby
<darix>
Mattx: normally i dont put debugger statements into files anymore. rescue Exception => ex ; binding.pry ; end
<darix>
and you can tinker
mdw has quit [Quit: Sleeping Zzzzz]
cHolthi1 has quit [Ping timeout: 248 seconds]
ensyde_ has joined #ruby
<Mattx>
sure, but you have to know where the bugs will be
<Mattx>
the only problem I've found so far with pry-rescue is that when you're running more than one thread, it'll stop the thread with the exception while the other keeps running
<Mattx>
so the output gets messed up
<Mattx>
(or so I think, I'm still figuring it out)
anjen has quit [Quit: anjen]
Aviio has joined #ruby
B4daBing73 has joined #ruby
B4daBing73 has quit [Changing host]
B4daBing73 has joined #ruby
marcofernandez has joined #ruby
cHolthi has quit [Ping timeout: 248 seconds]
<benzrf_irssi>
Tfw no happy medium between js, ruby, & python
Aviio has quit [Ping timeout: 244 seconds]
bezhermoso has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
TheCubeLord has quit [Quit: Leaving]
TheCubeLord has joined #ruby
nando293921 has joined #ruby
<shevy>
you have too much in your stack!
<shevy>
throw out js :)
bezhermoso has quit [Client Quit]
<benzrf_irssi>
eh
<benzrf_irssi>
you're right, i should've said between ruby and python
<Mattx>
darix, do you happen to know how you you move up into the stack? I've got an exception witin a gem, I want to see the code that called that method
<benzrf_irssi>
i only mentioned js because some aspects of it already reach the happy medium i want, but others are much worse than either of ruby or python
TheCubeLord has quit [Client Quit]
TheCubeLord has joined #ruby
BtcBen has quit [Ping timeout: 252 seconds]
_blizzy_ has quit [Quit: Leaving]
DoubleMalt has quit [Remote host closed the connection]
<darix>
Mattx: up/down maybe?
<Mattx>
yeah, I thought so but I needed to install pry-stack_explorer for up/down to work
<Mattx>
There will be a time for me to wonder how I could code without pry-rescue and pry-stack_explorer :P
<benzrf_irssi>
like, if you threw away js's syntax, just keeping the abstract syntax trees, and you stripped out almost all of its builtins and standard library, you'd get something pretty close to my ideal dynlang
<benzrf_irssi>
er, rather, something pretty close to what you'd get by doing the same thing to my ideal dynlang
<benzrf_irssi>
but of course the syntax and builtins and standard library are awful ;-;
sysodaff has quit [Remote host closed the connection]
n008f4g_ has quit [Ping timeout: 244 seconds]
djbkd has quit [Remote host closed the connection]
<Ox0dea>
benzrf_irssi: It can be. ^_^
otherj has joined #ruby
n008f4g_ has joined #ruby
cd-rum_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
SCHAAP137 has joined #ruby
trosborn has joined #ruby
chipotle has joined #ruby
mistermocha has joined #ruby
Suntzu has quit [Read error: Connection reset by peer]
rikkipitt has joined #ruby
* rik
ponders layout engines.
rikkipitt has quit [Remote host closed the connection]
marcdel has joined #ruby
cd-rum has joined #ruby
Marsupermammal has joined #ruby
<rik>
i have to choose between everything Sinatra supports, and I'm thinking abot going with erb, becase it's included. Is that sensible, or does erb suck badly enough that i should pick another one?
rodfersou has joined #ruby
Aviio has joined #ruby
Karix has joined #ruby
<nickjj>
rik, i never had any issues with erb
<benzrf>
that's not what a layout engine is, is it?
Karix has quit [Client Quit]
<benzrf_irssi>
aren't those called template engines?
<benzrf>
or templating engines
mistermocha has quit [Ping timeout: 248 seconds]
solars has quit [Quit: WeeChat 0.4.2]
<rik>
benzrf: no, to be fair, i did mean templating engine, in this case.
nettoweb has quit [Ping timeout: 244 seconds]
<riceandbeans>
can you ensure data types in a struct?
rubyx9 has quit [Ping timeout: 264 seconds]
<riceandbeans>
like Foo = Struct.new( :bar, :baz ) where :bar is Fixnum and :baz is Bool ?
<benzrf_irssi>
riceandbeans: if you want correctness constraints on code, your best bet is to look elsewhere
<shevy>
hmm perhaps you can patch it at runtime riceandbeans
havenwood has joined #ruby
havenwood has quit [Changing host]
havenwood has joined #ruby
SaintAardvark has quit [Ping timeout: 264 seconds]
bezhermoso has joined #ruby
<riceandbeans>
what's the best way to do it if you want correctness constraints?
<riceandbeans>
a class instead of a struct?
bezhermoso has quit [Client Quit]
Gasher^ has joined #ruby
Gasher has quit [Ping timeout: 240 seconds]
Anderson69s_Deb has quit [Quit: Leaving]
<shevy>
yeah
<shevy>
and use setter methods that ensure that these are always a fixnum or a bool and so on
chouhoulis has joined #ruby
sysodaff has joined #ruby
blt has quit [Ping timeout: 268 seconds]
chouhoulis has quit [Ping timeout: 276 seconds]
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sysodaff has quit [Ping timeout: 246 seconds]
x77686d_ has joined #ruby
x77686d has quit [Ping timeout: 276 seconds]
x77686d_ is now known as x77686d
<riceandbeans>
shevy: actually, I'm not sure how to go about this
<riceandbeans>
shevy: if I'm receiving json data, is it worth taking it and making a struct/class out of it, then referring to attr in them, or just parse the json and refer to it as keys of the json and leave it like that?
BtcBen has quit [Ping timeout: 252 seconds]
jdawgaz has joined #ruby
uglybandersnatch has quit [Ping timeout: 240 seconds]
jaequery has joined #ruby
blt has joined #ruby
binaryplease has quit [Ping timeout: 268 seconds]
Suntzu has joined #ruby
weemsledeux has joined #ruby
otherj has quit [Quit: .]
Anderson69s_Deb has joined #ruby
<shevy>
I dunno, I never was a big struct user
<shevy>
I always end up writing a class that does the parsing for data, add methods to it etc..
<shevy>
I mean it depends on what you want to be able to do
Guest60834 is now known as ruurd
<shevy>
if you want fancy methods, than fancy up that json hash
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<riceandbeans>
it's just dumb json being throw at an API
decoponyo has joined #ruby
firstdayonthejob has quit [Ping timeout: 244 seconds]
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]