jeffreylevesque has quit [Ping timeout: 240 seconds]
CloCkWeRX has joined #ruby
cdg_ has joined #ruby
Inside has joined #ruby
Inside has joined #ruby
n008f4g_ has joined #ruby
mykeura has quit [Quit: Konversation terminated!]
cdg has quit [Ping timeout: 244 seconds]
agentmeerkat has joined #ruby
cdg_ has quit [Ping timeout: 276 seconds]
wldcordeiro has joined #ruby
bob434 has quit [Quit: This computer has gone to sleep]
northfurr has joined #ruby
diegoaguilar has quit [Ping timeout: 246 seconds]
A124 has joined #ruby
mistermocha has joined #ruby
idefine has quit [Remote host closed the connection]
bob434 has joined #ruby
idefine has joined #ruby
baweaver has quit [Remote host closed the connection]
drewo has joined #ruby
Azure has quit [Ping timeout: 244 seconds]
BtcBen has joined #ruby
mistermocha has quit [Ping timeout: 250 seconds]
Azure has joined #ruby
bob434 has quit [Quit: This computer has gone to sleep]
someish has joined #ruby
mleung has quit [Quit: mleung]
intrigueD has quit [Remote host closed the connection]
<someish>
I’m just getting back into ruby after being away for a few years. I wanted to refresh my memory and learn some new tricks by reading someone elses code. Is there a gem that I would want to look at that is considered canon?
<cjheath>
Upgraded to Ruby 2.2.2, seeing strange issues with class << self (exception “wrong argument type nil (expected Symbol)”). Fixed it in my code by calling singleton_class, but now it’s biting in RSpec. Anyone else seen this?
Inside has quit [Ping timeout: 260 seconds]
htmldrum_ has quit [Ping timeout: 260 seconds]
htmldrum has quit [Ping timeout: 260 seconds]
rbennacer has joined #ruby
freerobby has quit [Quit: Leaving.]
lessless has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kam270 has quit [Quit: Leaving]
htmldrum has joined #ruby
htmldrum_ has joined #ruby
kobain has quit [Ping timeout: 260 seconds]
pawnbox has joined #ruby
watersoul has quit [Remote host closed the connection]
watersoul has joined #ruby
patrick-sartent has joined #ruby
leon_e has joined #ruby
patrick-sartent has quit [Max SendQ exceeded]
BtcBen has joined #ruby
stannard has joined #ruby
pawnbox has quit [Ping timeout: 276 seconds]
tref has joined #ruby
northfurr has quit [Quit: northfurr]
Gasher has joined #ruby
Regulati_ has joined #ruby
stannard has quit [Ping timeout: 248 seconds]
RegulationD has quit [Ping timeout: 244 seconds]
Musashi007 has quit [Quit: Musashi007]
maletor has quit [Quit: Computer has gone to sleep.]
kobain has joined #ruby
northfurr has joined #ruby
dc2 has joined #ruby
Snowy has joined #ruby
aspiers has quit [Ping timeout: 264 seconds]
ur5us has quit [Remote host closed the connection]
Uber|Dragon has joined #ruby
htmldrum_ has quit [Ping timeout: 252 seconds]
htmldrum has quit [Ping timeout: 252 seconds]
jottr has quit [Ping timeout: 268 seconds]
Gasher has quit [Ping timeout: 244 seconds]
mank has joined #ruby
razer_ has joined #ruby
User458764 has joined #ruby
<razer_>
Has anyone made a program for mac that can package a ruby file in a .app folder structure?
<razer_>
I found a general purpose program that could do any scripts, but it didn't work.
htmldrum has joined #ruby
htmldrum_ has joined #ruby
<razer_>
I also tried replacing other folder with my ruby file and fixing things and it would tell me my app was powerpc
User458764 has quit [Client Quit]
<razer_>
That is cool there is a ruby image in the background somehow. I didn't know IRC could do that.
`tim` has joined #ruby
jeffreylevesque has joined #ruby
rbennacer has quit [Remote host closed the connection]
jeffreylevesque has left #ruby [#ruby]
Musashi007 has joined #ruby
devbug has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
andywojo has joined #ruby
poguez_ has quit [Quit: Connection closed for inactivity]
<bopr>
i'm having the strangest behavior in my "gets"
freerobby has joined #ruby
<bopr>
when i print something to the screen followed by a gets, the console is blank, but after the next instruction comes in, then the program continues
arescorpio has joined #ruby
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ramfjord has joined #ruby
blackgoat has joined #ruby
SenpaiSilver has quit [Quit: Leaving]
halfamind has quit [Quit: Leaving.]
SenpaiSilver has joined #ruby
floatingpoint has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jdawgaz has joined #ruby
kinduff has joined #ruby
<Ox0dea>
bopr: Could you post a minimal example which doesn't behave as you expect?
rubynewbie has joined #ruby
<bopr>
Ox0dea: basically I have a puts statement before a gets, and when i run the program i don't see the puts statement until i hit return. really weird. https://gyazo.com/25dd0d640f95a45dc8c48bd2a471c446
<rubynewbie>
I need help with control flow on this guessing game that I am building. Even if you guess the proper number, it will continue to play the game and ask you to guess again. Here is my source code: http://pastebin.com/hdZA0hUN
<ruby[bot]>
rubynewbie: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
Yzguy has quit [Quit: Zzz...]
codecop has joined #ruby
mank has joined #ruby
valetudo has quit [Ping timeout: 244 seconds]
<bopr>
Ox0dea: i've narrowed it down to the puts that is causing issues. Working on something more complex with a prompt right now, and i can't see any puts "results" until i quit the program. infuriating.
<shevy>
rubynewbie I tried your code. it exited when I input the right number
<rubynewbie>
shevy: Did you run it from the command line?
<bopr>
i have ruby 2.2.4p230 on windows 10 x64
<shevy>
rubynewbie yeah always
<shevy>
rubynewbie what I do not understand is why you add +1 to the number
<rubynewbie>
I ran the program on command prompt. Windows 10
<rubynewbie>
shevy: I actually made a dice rolling program right before and deleted it.
<rubynewbie>
shevy: It is made in the same file
<rubynewbie>
So I had a rolling method
kalimotxo has joined #ruby
agentmeerkat has quit [Read error: Connection reset by peer]
<rubynewbie>
1 = rand(6)
<rubynewbie>
1+ rand(6)*
<rubynewbie>
I just didn't erase that part. Thanks for catching it
<shevy>
yeah that one works because rand(6) will also return 0 sometimes
<rubynewbie>
Oh yeah! I gotta add the rand in there for this program still
<rubynewbie>
So it should look like this: number_to_guess = 1 + (max_number)
<shevy>
you ask the user for a number, then you add +1 to it
<shevy>
why
<Ox0dea>
bopr: Post code.
<bopr>
Ox0dea: I've narrowed down the problem to the command prompt. basically "Git bash" which i'm using now for some reason likes the "gets" to execute before "puts" but it works fine in command prompt
<rubynewbie>
Because it is going to generate a number between 1 and the max number
maletor has joined #ruby
<rubynewbie>
shevy: The max number part is to make the program easier/harder, depending on the difficulty the user wants.
<rubynewbie>
So they can make it a random number between 1-10 or 1-10000 if they wanted
<bopr>
Ox0dea: the window on the right is waiting for input, the one on the left first printed "what is your name" and is waiting for input. window on the right isn't displaying the "what is your name":
Snowy has quit [Remote host closed the connection]
patrick-sartent has joined #ruby
abort has joined #ruby
patrick-sartent has quit [Client Quit]
<Ox0dea>
bopr: The problem is either your environment or the code on the lines you didn't show in that image.
ramfjord has quit [Ping timeout: 252 seconds]
<bopr>
Ox0dea: it's definitely the environment that's messing it up. Can you recommend me a better command prompt for windows? I like to be able to resize text size easily
fullofca_ has joined #ruby
someish has quit [Quit: someish]
<Ox0dea>
bopr: Are you sure? If you posted the full program that's giving you trouble, I could help you check that assumption.
wilbert has quit [Ping timeout: 244 seconds]
<Ox0dea>
rubynewbie: Yes, you'll want to use something like `rand(1..max_number)`, but your loop logic is way off.
<bopr>
Ox0dea: the other lines were just debug that i 100% commented out. The program is literally 3 lines. After i did the side by side comparison i am confident the prompt that i was using was messing with the input
<Ox0dea>
rubynewbie: For starters, you're checking the guess against `max_number` rather than `number_to_guess`.
abort has quit [Quit: leaving]
<bopr>
really appreciate your help though! I'm totally in love with ruby. When i learned hash tables can be created with one line I was in love
fullofcaffeine has quit [Ping timeout: 260 seconds]
dc2 has quit [Ping timeout: 246 seconds]
<bopr>
everything is working perfectly in cmd!
abort has joined #ruby
<Ox0dea>
bopr: Try putting a `STDOUT.flush` in after the first #puts call.
binaryplease2 has joined #ruby
patrick-sartent has joined #ruby
Inside has joined #ruby
Inside has joined #ruby
<bopr>
wow Ox0dea that actaully worked!
<Ox0dea>
Yay! Your terminal's buffering semantics are weird.
sleeptime is now known as uptime
abort has quit [Client Quit]
<bopr>
Ox0dea: what terminal are you using? I wanna be pro like you
abort has joined #ruby
fullofcaffeine has joined #ruby
<Ox0dea>
bopr: I use st, but that's largely irrelevant. Most terminals are line-buffered by default, but maybe yours has a setting or something.
leon_e has quit [Remote host closed the connection]
binaryplease1 has quit [Ping timeout: 244 seconds]
Spami has quit [Quit: This computer has gone to sleep]
TheNet has joined #ruby
leon_e has joined #ruby
<bopr>
Ox0dea: it's an "xterm" terminal on MINGW64 and i don't see any buffer options unfortunately
drewo has joined #ruby
silentpost has quit [Ping timeout: 240 seconds]
barajasfab has quit [Quit: Leaving]
joneshf-laptop has joined #ruby
fullofca_ has quit [Ping timeout: 260 seconds]
<bopr>
Ox0dea: thank you so much for your help, i won't forget :)
<Ox0dea>
bopr: The "real" xterm is pretty sane, but it does observe various escape sequences which change the mode it's in; maybe that's what happened? Hard to say from here.
Musashi007 has quit [Quit: Musashi007]
<Ox0dea>
Anyhow, glad you got it sorted. :) Probably figure out how to get your terminal to be line-buffered before proceeding; having to preemptively flush stdout after every write "just in case" is full of suck.
braincra- has quit [Quit: bye bye]
DonOtreply has joined #ruby
vqrs has quit [Ping timeout: 248 seconds]
<bopr>
Ox0dea: i'm gonna fix my vagrant lubuntu environment and go full linux in the future. can't stand the stupid "automatic updates need a restart" of w10
baweaver has joined #ruby
drewo has quit [Ping timeout: 250 seconds]
<Ox0dea>
bopr: I think that's a great idea.
cjbottaro has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
abort has quit [Quit: leaving]
abort has joined #ruby
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
yqt has quit [Ping timeout: 240 seconds]
dexteryy has joined #ruby
dexteryy has quit [Max SendQ exceeded]
dexteryy has joined #ruby
cjbottaro has joined #ruby
safe has quit [Quit: Leaving]
crowell has quit [Ping timeout: 268 seconds]
uglybandersnatch has quit [Ping timeout: 244 seconds]
Musashi007 has joined #ruby
`tim` has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
moei has joined #ruby
Tempesta is now known as ChoiKyuSang
dexteryy has quit [Max SendQ exceeded]
braincrash has joined #ruby
dexteryy has joined #ruby
abort has quit [Quit: leaving]
leon_e has quit [Quit: Konversation terminated!]
abort has joined #ruby
dexteryy has left #ruby [#ruby]
nando293921 has quit [Ping timeout: 244 seconds]
ChoiKyuSang is now known as Tempesta
maletor has quit [Quit: Computer has gone to sleep.]
smathy_afk has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<shevy>
w10 is a good starter for linux!
nhhc has joined #ruby
leon_e has joined #ruby
treaki__ has joined #ruby
treaki_ has quit [Ping timeout: 260 seconds]
agentmeerkat has joined #ruby
mistermocha has joined #ruby
crowell has joined #ruby
andywojo has joined #ruby
abort has quit [Quit: leaving]
abort has joined #ruby
aspiers has joined #ruby
brent_ has joined #ruby
griffindy has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<brent_>
Hi, had a question regarding accessing an instance variable from one class, inside another class
<brent_>
I have a board class w/ an @grid to represent the board. I want to access @grid in a method in another class to make a list of all the possible [row, col] combinations
Hue_ has joined #ruby
<shevy>
you access through a method
<Hue_>
Anyone online rn?
pawnbox has joined #ruby
weaksauce has quit [Remote host closed the connection]
Hue_ has quit [Client Quit]
<brent_>
can you elaborate
<brent_>
@grid is an attr_accesor
pawnbox has quit [Remote host closed the connection]
<brent_>
how do i reference the board instance in the player class?
<brent_>
is how i did workable, 'board.grid'
idefine has quit []
merida has joined #ruby
tref has quit [Quit: tref]
fedexo has quit [Ping timeout: 248 seconds]
howdoi has joined #ruby
stannard has joined #ruby
<shevy>
yes you invoke the method called .grid there
<brent_>
i understand that part
<shevy>
ok but you have no method called board there
<shevy>
so board.grid will evaluate to nil.grid
<brent_>
right
codecop has quit [Remote host closed the connection]
<brent_>
in my mind board should be the instance of the Board class it's calling .grid on
gix has joined #ruby
<shevy>
yes you try that via @board = board
<shevy>
but then you don't make use of @board
<shevy>
you probably forgot a attr_accessor :board
<brent_>
so my question is, if i added :board to attr_accessor
<brent_>
and left the rest as is
<shevy>
brent_ it may be easier if you write a class called Game that will handle all the different classes
<brent_>
would it reference the correct board, even though I"m not passing a board instance as an argument to ComputerPLayer?
<shevy>
you only need one instance of the game board
<shevy>
you are not passing the board to ComputerPlayer
<shevy>
so how can it know about it?
<brent_>
exactly
dc2 has joined #ruby
<brent_>
so i'm only initializing ComputerPLayer inside the game class, which has attr_accessor :player :board
<shevy>
store @board as class level instance variable on class Game and call to it
stannard has quit [Ping timeout: 240 seconds]
griffindy has joined #ruby
<shevy>
you can then access to it via Game.board, then you no longer need to use @board elsewhere
pawnbox has quit [Remote host closed the connection]
TheNet has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Eiam has quit [Quit: ╯°□°)╯︵ǝpouǝǝɹɟ]
<brent_>
so what if i did inside Game: def self.board_grid; @board.grid;end
<Ox0dea>
Well, that's exactly what #attr_reader is for.
<shevy>
brent_ yes that will work but you have to make sure that @board is initialized too
<brent_>
then I could call Game.board_grid.each_with_index
<brent_>
so board is initialized at the when you initialize Game
<shevy>
yes
hotpancakes has quit [Remote host closed the connection]
yatish27 has joined #ruby
pawnbox has joined #ruby
ericn81 has quit [Remote host closed the connection]
DiCablo has joined #ruby
arescorpio has quit [Remote host closed the connection]
codecop has joined #ruby
freerobby has quit [Quit: Leaving.]
Musashi007 has quit [Quit: Musashi007]
saneax is now known as saneax_AFK
nocontrol has joined #ruby
Musashi007 has joined #ruby
krz has joined #ruby
JoshGlzBrk has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
saneax_AFK is now known as saneax
<brent_>
appreciate your help shevy
<brent_>
so the fact that Board and PLayer are being initialized at the same time within game, should allow the Player to access Game.board_grid within it's methods w/out having been passed any instance of Game/Board
abort has quit [Quit: leaving]
abort has joined #ruby
aspiers_ has joined #ruby
abort has quit [Client Quit]
aspiers has quit [Ping timeout: 268 seconds]
sauvin has joined #ruby
ixti has quit [Quit: WeeChat 1.4]
BtcBen has quit [Quit: ChatZilla 0.9.92 [Firefox 44.0.2/20160210153822]]
<shevy>
yeah that is one way
<shevy>
you could also pass the instance to each player when you invoke .new
<shevy>
and there are probably more ways still
<shevy>
you could even use $vars!
abort has joined #ruby
TheNet has joined #ruby
<shevy>
or @@vars ... but these I hate
rrrepsaj has joined #ruby
pawnbox has quit []
dionysus69 has joined #ruby
tildes has joined #ruby
sneakerhax has quit [Ping timeout: 248 seconds]
blackmesa has joined #ruby
krz has quit [Ping timeout: 264 seconds]
abort has quit [Client Quit]
ascarter has joined #ruby
pawnbox has joined #ruby
abort has joined #ruby
mleung has joined #ruby
<brent_>
so the reason i didn't want to pass an instance of board to player is because they're being initialized at the same time as arguments to another method
solocshaw has quit [Ping timeout: 246 seconds]
LoneHermit has joined #ruby
<brent_>
so Game.new(Player.new, Board.new)
griffindy has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Inside has quit [Ping timeout: 260 seconds]
abort has quit [Client Quit]
jam_ has joined #ruby
abort has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
hotpancakes has joined #ruby
<brent_>
@@vars are class variables, right? and $var global?
abort has quit [Client Quit]
abort has joined #ruby
Don_John has quit [Read error: Connection reset by peer]
fullofcaffeine has quit [Remote host closed the connection]
rrrepsaj has quit [Remote host closed the connection]
Yzguy has quit [Quit: Zzz...]
fullofcaffeine has joined #ruby
Yzguy has joined #ruby
hotpancakes has quit [Ping timeout: 244 seconds]
Yzguy has quit [Client Quit]
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rubynewbie has quit [Ping timeout: 250 seconds]
guatajuk has joined #ruby
leon_e has quit [Read error: Connection reset by peer]
leon_e has joined #ruby
hotpancakes has joined #ruby
fullofcaffeine has quit [Ping timeout: 260 seconds]
ascarter has joined #ruby
<Ox0dea>
brent_: Player shouldn't have to know anything about Board; use Game to coordinate them.
ascarter has quit [Client Quit]
<brent_>
thats what i'm going for
<brent_>
0x0dea
<brent_>
so is my above Game class method to return @board.grid the best solution?
pwnd_nsfw has quit [Ping timeout: 248 seconds]
jdawgaz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0dea>
brent_: Board just needs an `attr_reader :grid`, unless I've missed some nuance.
yfeldblum has quit [Ping timeout: 250 seconds]
hk238 has joined #ruby
<brent_>
it does have that
elifoster has quit [Ping timeout: 240 seconds]
<brent_>
so how would reference that inside another class?
<brent_>
i'm just struggling to get my head around this concept
<ninjaaron>
Ox0dea: I'm always trying to use perl idioms in ruby, because people always talk about the influence of perl syntax on ruby (which is significant), but a lot of things are at lot more like python. Maybe I should just do a tutorial and learn ruby for real...
<Ox0dea>
ninjaaron: Yeah, that seems like a good idea. :)
Musashi007 has joined #ruby
<ericli>
I saw someone is using Mixlib::ShellOut
<ericli>
ramfjord has joined #ruby
LoneHermit has joined #ruby
<Ox0dea>
ninjaaron: Ruby is quite the hodge-podge, but *good* Ruby code tends to let the Smalltalk and Lisp influences shine through over the Perl one.
<Ox0dea>
ericli: If you want an external dependency for what a standard library can do just as well, that's entirely your prerogative. Mixlib does provide various conveniences, but are you sure you need them?
<ericli>
Ox0dea, I need to run a command then print out the output also check the return value
<Ox0dea>
ericli: Yep, I read that part.
<ninjaaron>
Ox0dea: I kind of like perl. I know that makes me a bad person, but I can't help it. I started programming with BASH, and perl is sort of like bash+sed+awk with more helpful types.
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
<Ox0dea>
ninjaaron: No, I don't see why that should make you a bad person. It's a tool like any other, and I'm sure the strengths and weaknesses balance, give or take.
<brent_>
0x0dea, i appreaciate your help, i have to go, but may try and bug you about this again next time i see you on
DonOtreply has quit [Quit: DonOtreply]
<Ox0dea>
brent_: No worries. I'll see you around. :)
drewo has joined #ruby
<brent_>
have a good night
<ninjaaron>
Ox0dea: yeah. Perl doesn't scale super well, but for short scripts, it's pretty great. It's almost like the shorter the script is, the more awesome perl becomes, especially if the task is related to text transformation.
uglybandersnatch has joined #ruby
<Ropeney>
ninjaaron, untill you need to remember how it does what it does
<Ox0dea>
ninjaaron: Ruby was rather explicitly designed to ensure it met that niche, and I think it does so quite well.
Xiti has quit [Quit: Xiti]
drewo has quit [Ping timeout: 248 seconds]
Salve has quit [Remote host closed the connection]
th0m_ has quit [Remote host closed the connection]
WhoLettem has quit [Ping timeout: 250 seconds]
mgorbach has quit [Ping timeout: 248 seconds]
amclain has quit [Quit: Leaving]
BrunoSaboia has quit [Ping timeout: 268 seconds]
jam_ has quit [Remote host closed the connection]
Salve has joined #ruby
vqrs has joined #ruby
Disavowed has joined #ruby
ninjaaron has quit [Quit: WeeChat 1.4]
dionysus69 has quit [Ping timeout: 244 seconds]
<ericli>
hi, how do I know what external Modules do I have in my ruby env?
<Ox0dea>
ericli: If you want the actual exit code, sure, but you're just checking whether or not the command succeeded.
<ericli>
is that okay?
<ericli>
Ox0dea, yes, just wanna know if it is succeeded.
<Ox0dea>
ericli: There's a method for that. :P
moeabdol has quit [Quit: WeeChat 1.4]
hotpancakes has joined #ruby
<ericli>
Ox0dea, you mean to_i == 0 ?
cdikny has joined #ruby
pawnbox has quit [Ping timeout: 252 seconds]
leon_e has quit [Quit: Konversation terminated!]
nocontrol has quit [Ping timeout: 276 seconds]
lkba has joined #ruby
mr_robot_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
futilegames has joined #ruby
hotpancakes has quit [Ping timeout: 268 seconds]
nocontrol has joined #ruby
leon_e has joined #ruby
Musashi007 has quit [Quit: Musashi007]
ta_ has quit [Remote host closed the connection]
jam_ has joined #ruby
hotpancakes has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
stardiviner has joined #ruby
Guest67598 has joined #ruby
PaulCape_ has joined #ruby
<Guest67598>
sup
Guest67598 is now known as [Tyrant]
<[Tyrant]>
sup
guatajuk has quit [Quit: guatajuk]
PaulCapestany has quit [Ping timeout: 276 seconds]
<[Tyrant]>
anyone in charge awake?
ericli has quit [Ping timeout: 240 seconds]
rrrepsaj has joined #ruby
<UKn0Me>
happy easter
solars has quit [Ping timeout: 250 seconds]
lurch_ has joined #ruby
devbug has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
skade has joined #ruby
rrrepsaj has quit [Remote host closed the connection]
pwnd_nsfw has joined #ruby
AlexRussia has quit [Ping timeout: 246 seconds]
Guest61911 has joined #ruby
ur5us has quit [Ping timeout: 276 seconds]
Disavowed has joined #ruby
Mon_Ouie has joined #ruby
<Disavowed>
How would I access a module level variable from another class? I've declared like this? module A @var = 'test' but I can't get to it with A.var or A::var and now I'm questioning what little I know about scoping in Ruby.
scepticulous has joined #ruby
<toretore>
`module A; @var = 'test'; end` doesn't make any sense. what are you trying to do?
firstdayonthejob has joined #ruby
<Ox0dea>
Sure it does.
PaulCapestany has joined #ruby
<Ox0dea>
Module-level instance variables are a perfectly reasonable thing to use.
kp666 has quit [Ping timeout: 244 seconds]
baweaver has quit [Remote host closed the connection]
<Disavowed>
toretore: 0x0dea if it's not idiomatic I guess I could put it in a class, but that feels boilerplate-y
<Ox0dea>
It's not unidiomatic, but it still might not be the right thing.
PaulCape_ has quit [Ping timeout: 240 seconds]
JohnBat26 has quit [Read error: Connection reset by peer]
<Disavowed>
0x0dea: That seems like a good use case. My one does not. Let me knock up a pastebin explaining it better.
finisherr has quit [Quit: finisherr]
<[Tyrant]>
can someone remind me of Radar’s other ROR chan, i dont log...
<Ox0dea>
[Tyrant]: #RubyOnRails?
<[Tyrant]>
or JR’s
<Disavowed>
Here's an undoubtedly awful approach to what I was trying to do: https://eval.in/541672
Cohedrin has joined #ruby
<[Tyrant]>
who goes by pipework these days
rmulligan has joined #ruby
<Ox0dea>
pipework still goes by pipework.
kp666 has joined #ruby
<Ox0dea>
Disavowed: I'm intrigued. ^_^
<Disavowed>
0x0dea: That can't be a good sign!
<[Tyrant]>
im banned from #rubyonrails because of radar
<[Tyrant]>
he is dramatic
ta_ has joined #ruby
Rahul_Roy has joined #ruby
<[Tyrant]>
so i was invited to another chan
<[Tyrant]>
i cant remember it this late
<Ox0dea>
Disavowed: I reckon the most idiomatic approach here would be to keep track of subclasses of Algorithm.
<Ox0dea>
But, well, MergeSort shouldn't really be a class, so that'd be a little egregious.
mark4 has joined #ruby
<Disavowed>
0x0dea: If it helps, it's just to show code on a front end; there's no plans to run it (yet!)
skade has quit [Read error: Connection reset by peer]
<toretore>
i usually use constants for this purpose
skade has joined #ruby
<toretore>
Algorithms::MERGESORT
merida_ has quit [Remote host closed the connection]
aufi has joined #ruby
<Disavowed>
toretore: I think that's what I was hopelessly trying to do. It feels more natural. Then again, I'm new to Ruby, so take that with a pinch of salt.
devbug has joined #ruby
modin has quit [Ping timeout: 264 seconds]
<Disavowed>
0x0dea: Would keeping track of subclasses just require me to use .ancestors and .descendants, or is there something more logical?
noname has joined #ruby
<toretore>
Algorithms.mergesort "looks nicer", but it is still effectively a constant
modin has joined #ruby
Ropeney has joined #ruby
flughafen has quit [Ping timeout: 268 seconds]
<Ox0dea>
Disavowed: The #inherited hook fires during subclassing.
JohnBat26 has quit [Read error: Connection reset by peer]
<Disavowed>
0x0dea: Nice. I'll look into that now.
rmulligan has quit [Ping timeout: 268 seconds]
jorum has quit [Ping timeout: 268 seconds]
andikr has joined #ruby
JohnBat26 has joined #ruby
<Ox0dea>
Disavowed: This "works", but the necessity of the `this` there should let you know that it's pretty not great: https://eval.in/541673
noname has quit [Ping timeout: 244 seconds]
bricker has quit [Ping timeout: 260 seconds]
andywojo has joined #ruby
djellemah has quit [Ping timeout: 276 seconds]
<Disavowed>
0x0dea: TIL define_singleton_method and p; I should come here more often!
* TheGreatGudsby
has quit (K-Lined)
aganov has joined #ruby
Blue_Ice has joined #ruby
Blue_Ice has joined #ruby
cd-rum has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
andywojo has quit [Ping timeout: 260 seconds]
flughafen has joined #ruby
JohnBat26 has quit [Read error: Connection reset by peer]
A124 has quit [Quit: '']
<Disavowed>
Alright, off to work to half-heartedly sling Python :( Thanks for all your help 0x0dea and toretore, appreciate you both taking the time.
jam_ has quit [Remote host closed the connection]
JohnBat26 has joined #ruby
n008f4g_ has joined #ruby
A124 has joined #ruby
<Ox0dea>
Disavowed: Python has the vast majority of Ruby's goodness hiding under the covers, but I'm fine with that being kept a secret. :P
pablo has quit [Quit: Leaving]
TheGreatGudsby has quit [Quit: You had my curiosity. But now you have my attention]
brent_ has quit [Quit: Connection closed for inactivity]
<Disavowed>
0x0dea: Have you tried metaprogramming in Python?! I've only been doing Ruby about 3 weeks now but I'm consistently impressed with the thought that has gone into designing it. I think I'm leaving Python!
noname has joined #ruby
<Dimik>
gnite
<Disavowed>
0x0dea: Also I don't think we have method_missing, which looks pretty incredible
<Ox0dea>
Disavowed: I freely concede that metaprogramming is *significantly* more pleasant in Ruby.
<Disavowed>
0x0dea: or dynamic dispatch, unless you bully a dict lookup I guess
<Ox0dea>
Disavowed: You'd be surprised just how much of Ruby and Python is "dict bullying".
blackmesa has joined #ruby
<Disavowed>
0x0dea: I'm reading metaprogramming Ruby currently and I feel like I didn't know what metaprogramming was, coming from Python!
<Disavowed>
0x0dea: You're probably right.
<Ox0dea>
Ha! That's a fair assessment, I think; it's not really the done thing there.
<Ox0dea>
It's not hidden either, mind, you just have to dig a little past the surface.
<Ox0dea>
Well, it's not hidden *well*. :P
<Ox0dea>
__sore_thumb__
<Disavowed>
0x0dea: Even the Google Python Style Guide discourages using it in any form, which should tell you something.
hotpancakes has joined #ruby
<Disavowed>
I don't miss __this_thing__ at all.
<Disavowed>
Alright, later. Thanks again!
<Ox0dea>
Au revoir!
_blizzy_ has quit [Quit: Leaving]
[Tyrant] has quit [Quit: [Tyrant]]
tvw has joined #ruby
Dimik has quit [Ping timeout: 244 seconds]
cd-rum has joined #ruby
Disavowed has quit [Quit: leaving]
blackmesa has quit [Ping timeout: 268 seconds]
leon_e has joined #ruby
hotpancakes has quit [Ping timeout: 244 seconds]
jaruga has joined #ruby
benlieb has joined #ruby
jaruga is now known as jaruga_
symm- has joined #ruby
Tyrant has joined #ruby
Tyrant has quit [Client Quit]
Guest61911 has quit [Ping timeout: 246 seconds]
pawnbox has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
skade has joined #ruby
skade has quit [Client Quit]
gh has joined #ruby
<adaedra>
Hello
the_drow has joined #ruby
firstdayonthejob has quit [Ping timeout: 264 seconds]
<apeiros>
look at the return value. the @ is dropped. but if it's not considered to be part of the symbol literal, then how come it's not a syntax error?
<adaedra>
!@ and ! is the same for ruby, apparently
<Ox0dea>
Just so.
<Ox0dea>
Lemme find the spot in parse.y.
<bhaak>
has anybody tried to mock/overwrite I18n.translate?
moeabdol has joined #ruby
Musashi007 has quit [Quit: Musashi007]
<apeiros>
bhaak: anybody is corrently not online. maybe just ask your question?
<adaedra>
?anybody
<ruby[bot]>
jhass is anybody
<apeiros>
though, potentially you'd be better of asking in #rubyonrails
<bhaak>
I wanted to do that for a test but ran into problems as it is implemented as "module I18n; extend(Module.new {def translate; ...; end } ... "
<bhaak>
apeiros: nope, I mean the ruby gem, not the stuff used by rails.
<Ox0dea>
bhaak: You want to get hold of an anonymous Module?
saneax is now known as saneax_AFK
<apeiros>
I don't see why it'd matter from where a method is coming in order to mock it
<apeiros>
and you can always get hold of the owner of a method easily: I18n.method(:translate).owner
yosafbridge has joined #ruby
hotpancakes has joined #ruby
<bhaak>
apeiros: yeah, I got as far but it didn't work when I tried to overwrite the translate method for this module, it didn't stick. the original one was still being called
elcontrastador has quit [Ping timeout: 264 seconds]
<apeiros>
then maybe it's not called via I18n.translate
DenSchub_ is now known as DenSchub
<bhaak>
maybe, I'd have to test again if I checked every case because of the alias :t :translate
<bhaak>
in the end I did I18n.extend(Module.new { def t!(key, options={}); ...; end }) in the before and redefining it back in the after block. but that feels dirty and I don't have a clue why it didn't work the other way
<Ox0dea>
bhaak: Maybe look into Module#prepend.
hotpancakes has quit [Ping timeout: 264 seconds]
tenderlove has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<bhaak>
Ox0dea: prepend always gives me headaches. every time I read it up I think I understand and then run into problems using it. :-/
<bhaak>
but I'll have to do a proper minimal example first. I just wanted to be sure that I didn't overlook something obvious and simple.
<gregf_>
hello. is there a limit on how many thread can be running at the same time?
<gregf_>
*threads
<gregf_>
i've got a 16 cpu machine. if i start 100 threads .. they launch.. but if i start 200 .. nothing moves forward :|
yfeldblum has quit [Ping timeout: 268 seconds]
mark4 has left #ruby ["PART #jquery :PART ##javascript :PONG :sendak.freenode.net"]
yfeldblum has joined #ruby
waxxy has joined #ruby
<bhaak>
gregf_: how does the load of your machine look like?
<Ox0dea>
bhaak: It's pretty straightforward, really; the prepended Module goes at the front of the ancestor chain and is thus first in line for deciding whether or not to respond to a given method.
<Ox0dea>
You can `super` up into the original, and use #remove_method to get out of the way entirely.
<apeiros>
gregf_: threads use filehandles, so if your OS limits a process' number of filehandles, then that'd be an issue.
saneax_AFK is now known as saneax
<apeiros>
also since ruby now backs threads with OS native threads, the OS might directly limit the number of threads too
Snowy has joined #ruby
<gregf_>
oh, nevrmind. problem with my coe :|
<gregf_>
*doce
<gregf_>
*cries*
<gregf_>
s/doce/code/
User458764 has joined #ruby
<gregf_>
apeiros: bhaak thanks anyways!
<bhaak>
Ox0dea: that's how I think it should work but I seem to more often than not get it wrong anyway. but the idea with #remove_method could be handy sometimes. thanks
<Ox0dea>
bhaak: No worries. It's usually much better than mucking about with alias chains and the like.
<Ox0dea>
#unprepend would be nice, but that'd pave the way for full-on ancestor modification.
noname has quit [Ping timeout: 260 seconds]
<scepticulous>
I am using bundle install --deployment to create a production ready version of my app locally (for building a docker image) and all gems are written to vendor/bundle correctly but, using bundle exec always complains about the executable not being there. So bundle exec rails s fails because it does not find rails
<ruby[bot]>
acosonic: Please do not crosspost without at least telling so and mentioning provided suggestions and their outcome in all channels. Experience shows that people don't do either, and not doing so is considered rude.
<acosonic>
ok
scepticulous has quit [Ping timeout: 248 seconds]
bricker has joined #ruby
<gregf_>
class/static/globals variables can really mess up threads :|
stannard has quit [Remote host closed the connection]
<gregf_>
i've written a client that uses Net::HTTP for making 1000 requests in 1000 threads with a sleep. and the sleep always ended up as 1000 save for some few
<gregf_>
*i'd
<gregf_>
stress testing a Java conversion service
prestorium has joined #ruby
jam_ has quit [Ping timeout: 260 seconds]
yorickpeterse1 has joined #ruby
console has joined #ruby
hotpancakes has quit []
Es0teric has joined #ruby
rippa has joined #ruby
dionysus69 has joined #ruby
dn` has quit [Quit: dn`]
connor_g1odwolf has joined #ruby
dn` has joined #ruby
lkba has quit [Remote host closed the connection]
Gasher has quit [Ping timeout: 240 seconds]
Gasher has joined #ruby
kenichi_ has joined #ruby
nocontro_ has joined #ruby
j416_ has joined #ruby
hyperdri- has joined #ruby
pjaspers has joined #ruby
df- has joined #ruby
D9- has joined #ruby
dfas has quit [*.net *.split]
floatingpoint has quit [*.net *.split]
abort has quit [*.net *.split]
mfaeh has quit [*.net *.split]
DoubleMalt has quit [*.net *.split]
joneshf-laptop has quit [*.net *.split]
skweek has quit [*.net *.split]
nofxx has quit [*.net *.split]
kenichi has quit [*.net *.split]
ozzloy_ has quit [*.net *.split]
duderonomy has quit [*.net *.split]
alnewkirk has quit [*.net *.split]
RTG` has quit [*.net *.split]
edwardly has quit [*.net *.split]
axisys has quit [*.net *.split]
e has quit [*.net *.split]
D9 has quit [*.net *.split]
tw1sted has quit [*.net *.split]
berserk_ren has quit [*.net *.split]
hyperdrive has quit [*.net *.split]
reaVer has quit [*.net *.split]
callumacrae has quit [*.net *.split]
df has quit [*.net *.split]
jrod has quit [*.net *.split]
pjaspers_ has quit [*.net *.split]
Cyrus has quit [*.net *.split]
linduxed has quit [*.net *.split]
skakri has quit [*.net *.split]
bitemyapp has quit [*.net *.split]
m4rCsi_ has quit [*.net *.split]
connor_goodwolf has quit [*.net *.split]
Brando753 has quit [*.net *.split]
Kim^J has quit [*.net *.split]
j416 has quit [*.net *.split]
z3uS has quit [*.net *.split]
yorickpeterse has quit [*.net *.split]
j416_ is now known as j416
<waxjar>
gregf_ stress-testing using ruby?
chouhoulis has joined #ruby
<gregf_>
well, yeah. so i used threads
Brando753 has joined #ruby
<gregf_>
just making http requests
jrod has joined #ruby
griffindy has joined #ruby
scepticulous has joined #ruby
console is now known as e
nocontrol has quit [Ping timeout: 252 seconds]
davedev24 has quit [Ping timeout: 268 seconds]
acosonic has quit [Quit: acosonic]
riceandbeans has quit [Ping timeout: 244 seconds]
nocontro_ has quit [Ping timeout: 240 seconds]
riceandbeans has joined #ruby
riceandbeans has quit [Changing host]
riceandbeans has joined #ruby
lkba has joined #ruby
cdg has joined #ruby
Es0teric has quit [Read error: Connection reset by peer]
nocontrol has joined #ruby
Es0teric has joined #ruby
David27 has joined #ruby
dikaio has joined #ruby
drale2k has quit [Ping timeout: 264 seconds]
acosonic has joined #ruby
Blaze_Boy has quit [Ping timeout: 276 seconds]
Sammichmaker has quit [Quit: Leaving]
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Es0teric has quit [Read error: No route to host]
Es0teric has joined #ruby
AlexRussia has joined #ruby
Cyrus has joined #ruby
<shevy>
global variables mess up threads as well gregf_?
floatingpoint has joined #ruby
duderonomy has joined #ruby
skweek has joined #ruby
Cyrus is now known as Guest36566
<dopie>
how do i update my system ruby to the most recent version?
rodfersou|lunch is now known as rodfersou
<j2k>
dopie Depends on your system
<dopie>
mac osx 10
mary5030_ has joined #ruby
<dopie>
yosemite
<lagweezle>
homebrew! <3
perlgod_ has joined #ruby
<dopie>
lagweezle: im trying to update the system one because vim keeps on using it...
<shevy>
dopie come to linux!
Trynemjoel has quit [Quit: Quitting]
<dopie>
shevy: I did... I prefer mac osx better honestly
<dopie>
i actually switched from linux to mac
Devalo has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
* neilhwatson
is going to be assigned a mac book next week and will miss linux :(
jhn has joined #ruby
Kim^J has joined #ruby
skakri has joined #ruby
reaVer has joined #ruby
berserk_ren has joined #ruby
DoubleMalt has joined #ruby
callumacrae has joined #ruby
alnewkirk has joined #ruby
bitemyapp has joined #ruby
edwardly has joined #ruby
axisys has joined #ruby
joneshf-laptop has joined #ruby
RTG` has joined #ruby
linduxed has joined #ruby
z3uS has joined #ruby
abort has joined #ruby
mfaeh has joined #ruby
ozzloy_ has joined #ruby
nofxx has joined #ruby
tw1sted has joined #ruby
m4rCsi_ has joined #ruby
merida has joined #ruby
poguez_ has joined #ruby
callumacrae has quit [Max SendQ exceeded]
<dopie>
sooo
Trynemjoel has joined #ruby
Es0teric has quit [Remote host closed the connection]
JakFrist has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<bougyman>
I can't make a time object out of just intervals
drale2k has joined #ruby
Trynemjoel has quit [Ping timeout: 244 seconds]
<Canar>
...
<Canar>
if you say so
<bougyman>
Canar: how could I?
<Canar>
Did you even read the replies?
<bougyman>
there's no 'Time' in : it took an hour and 40 minutes and 12.21 seconds.
<bougyman>
yes
rattatmatt has joined #ruby
<Canar>
Well then, I'm sorry, I don't have the time to explain further.
User458764 has joined #ruby
workmad3_ is now known as workmad3
nando293921 has joined #ruby
bluOxigen has quit [Ping timeout: 276 seconds]
vasilakisfil has joined #ruby
<vasilakisfil>
a closure in Ruby (and other languages) encapsulates the environment that is defined on.. how can I achieve the opposite? I want do define something in place A, call it in place B and reference variables from place B
Trynemjoel has joined #ruby
stardiviner has quit [Ping timeout: 244 seconds]
<adaedra>
vasilakisfil: you can change the context of a lambda with instance_exec
kfpratt has joined #ruby
<adaedra>
but it won't work with variables, only instance variables/methods/self
marxarelli has joined #ruby
<adaedra>
there may be something in binding tho
dikaio_ has joined #ruby
Shaboum has joined #ruby
dikaio has quit [Ping timeout: 252 seconds]
Salve has joined #ruby
amclain has joined #ruby
moeabdol has joined #ruby
aufi has quit [Quit: Konversation terminated!]
mondok has quit [Ping timeout: 240 seconds]
halfamind has quit [Read error: Connection reset by peer]
KINGSABRI has joined #ruby
halfamind has joined #ruby
ascarter has joined #ruby
<lagweezle>
bougyman: could try using the word 'interval' maybe?
<KINGSABRI>
Hello! I'm using Fiddle importer to interact with some Windows API and it works well but I cant parse with it's retrun which is something line that #<Fiddle::Pointer:0x1e87fb0 ptr=0x7678ea71 size=0 free=0x000000>
<KINGSABRI>
I need the ptr value
<KINGSABRI>
so if I but prt method it gives me another value
moeabdol has quit [Ping timeout: 268 seconds]
<KINGSABRI>
is there any parser or a way to parse that Fiddle::Pointer object ?
nfk|laptop has quit [Quit: yawn]
Karix has quit [Read error: Connection reset by peer]
<hanmac>
did you guys hear that story from that AI from Microsoft? it was a chatbot which was programmed to learn, but after the Bot does say that it hates feminists, she got "reprogrammed" ;P
rattatmatt has quit [Remote host closed the connection]
rattatmatt has joined #ruby
<Ox0dea>
KINGSABRI: It's not perfectly clear what you're asking. If you're trying to go from that Fiddle::Pointer to a Ruby object, you want #to_value.
<Canar>
hanmac: They found a loophole that they could use to get it to repeat content verbatim.
cjbottaro has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<KINGSABRI>
@0x0dea I'm asking if I can parse the returned Fiddle::Pointer object
<shevy>
an AI with a loophole! fear skynet 3.0!!!
halfamind has quit [Read error: Connection reset by peer]
halfamind has joined #ruby
<KINGSABRI>
0x0dea so I can have an access to "ptr=0x7678ea71" value
<Ox0dea>
KINGSABRI: You can just call #ptr on it...
<KINGSABRI>
I don't want to convert it to string using inspect then parse it as string and use regex
howdoi has joined #ruby
<Ox0dea>
Yeah, don't do that.
araujo has joined #ruby
d0nn1e has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
rattatmatt has quit [Ping timeout: 276 seconds]
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
marr has joined #ruby
halfamind has quit [Read error: Connection reset by peer]
halfamind1 has joined #ruby
<KINGSABRI>
if I use .ptr it returns me another object #<Fiddle::Pointer:0x12bff68 ptr=0x77d8050b size=0 free=0x000000> with a new ptr value
LoneHermit has joined #ruby
d0nn1e has joined #ruby
nobitanobi has joined #ruby
JoshGlzBrk has joined #ruby
JoshGlzBrk has quit [Client Quit]
<KINGSABRI>
0xdea so the same issue remains
Shaboum has quit [Quit: WeeChat 1.4]
<Ox0dea>
KINGSABRI: Right, sorry. `ptr.to_value.object_id` should do the trick.
rbennace_ has quit [Remote host closed the connection]
skade has quit [Quit: Computer has gone to sleep.]
<KINGSABRI>
0x0dea I tried it and it returns wrong value
<Ox0dea>
KINGSABRI: Are you sure?
the_drow has quit [Quit: This computer has gone to sleep]
<ytti>
lagweezle, python and ruby code idiomatically use exceptions in very similar manner
maletor has joined #ruby
<smathy>
PaulePanter, if you're worried about tenths of a second over millions of iterations, Ruby's the wrong language for you.
Apocalypse has quit [Ping timeout: 264 seconds]
DarkBushido has quit [Ping timeout: 246 seconds]
<PaulePanter>
smathy: Very true. ;-)
rubie has joined #ruby
scepticulous has quit [Ping timeout: 276 seconds]
<havenwood>
PaulePanter: A quick benchmark-ips shows the lonely person operator from Ruby 2.3 is faster than rescue.
<lagweezle>
PaulePanter: I like that the article is saying that the use of exception handling as a flow-control mechanism is bad(-ish), because I dislike the idiom of try/except (or rescue) in place of if-statements, and such.
<smathy>
...and also, nodes&.first ftw - yay 2.3
ericli has joined #ruby
scepticulous has joined #ruby
<lagweezle>
ytti: I've not encountered that in Ruby yet. Lucky me? ;)
<smathy>
lagweezle, yeah, they're called "exceptions" for a reason.
mistermocha has joined #ruby
<PaulePanter>
Thank you everyone! As always you helped me quite a lot!
<lagweezle>
They take it a step (or many?) towards worse at work, too, and wrap a ton of lines in the 'try' part, with 'except Exception' at the end of the entire mess... -.-
snockerton has joined #ruby
* PaulePanter
unfortunately still uses Ruby 2.1.5.
<havenwood>
PaulePanter: It's a good idea to at least bump to the latest teeny 2.1.8 if you're on 2.1.
SCHAAP137 has quit [Remote host closed the connection]
nocontrol has joined #ruby
<havenwood>
"We are planning to release Ruby 2.1.9 by the end of March. After the release, we will end the normal maintenance phase of 2.1, and start the security maintenance phase of it."
<PaulePanter>
havenwood: I use the Debian stable package, which carries the security fixes.
htmldrum has joined #ruby
htmldrum_ has joined #ruby
<havenwood>
PaulePanter: Ah, good. :)
mistermocha has quit [Ping timeout: 250 seconds]
<PaulePanter>
havenwood: Your example only tried the case, when the exception occurs, right?
<PaulePanter>
The standard case should be, when no exception occurs.
aganov has quit [Remote host closed the connection]
<lagweezle>
ytti: Just to make sure, did you mean they both use them for if-else flow control, or the general "do things that might blow up then rescue when they do blow up" ?
<ytti>
lagweezle, idiomatic python and ruby code does not use it for if-else
<ytti>
(i must confess, i sometimes do, but my says girls like bad boys)
<havenwood>
PaulePanter: Same speed in that case.
baweaver has quit [Remote host closed the connection]
nobitanobi has quit [Remote host closed the connection]
<floatingpoint>
yo. I should see the string printed when I use: case some_string; when /.+\(3\),$/; puts some_string; if some_string = "beep (3),", right?
joonty has quit [Ping timeout: 240 seconds]
<havenwood>
PaulePanter: Though a better warmup for rescue.
rkazak has quit [Ping timeout: 240 seconds]
KensoDev has joined #ruby
halfamind has quit [Read error: Connection reset by peer]
<havenwood>
akp: ^ install latest JRuby to /usr/local
<lagweezle>
I'm with you there. Things like len() being a global, except not really, because you need to implement __len__ for your class ... bleah.
mrgrieves has quit [Ping timeout: 260 seconds]
<akp>
package managers on top of package managers on top of package manageres
<lagweezle>
I'm with you there. Things like len() being a global, except not really, because you need to implement __len__ for your class ... bleah. (meant as reply to ytti)
drewo has joined #ruby
<havenwood>
akp: ruby-install and chruby are simple shell scripts that each do one thing, and one thing well
pfg__ has joined #ruby
iamvery has joined #ruby
freerobby has quit [Quit: Leaving.]
Cone3 has quit []
scepticulous has quit [Ping timeout: 252 seconds]
weckl has quit [Remote host closed the connection]
JakFrist has joined #ruby
finisherr has joined #ruby
David27_ has joined #ruby
nocontrol has joined #ruby
David27 has quit [Ping timeout: 248 seconds]
David27_ is now known as David27
jam_ has joined #ruby
Don_John has joined #ruby
<akp>
well ruby-install seems to fail to download anything....
nobitanobi has quit [Remote host closed the connection]
<shevy>
ethe chop up the task and split it up
<shevy>
1) first obtain the array with your entries 2) sanitize them if necessary 3) build up the command for ffmpeg 4) output it to verify that it is correct 5) use system() or ``
nocontrol has quit [Ping timeout: 244 seconds]
<shevy>
if the name of the file has a ' ' one workaround is to pad the whole name into a ""
<eam>
ethe: your problem is actually in the backticks -- you're constructing bad shell
<ethe>
eam: it never gets there
edwinvdgraaf has quit [Ping timeout: 248 seconds]
<eam>
ethe: what happens when you run your code? Include the error
B1n4r10 has joined #ruby
<eam>
Dir.glob will handle spaces fine -- the only potential for error here is in your backticks
dhollinger has joined #ruby
<ethe>
it doesnt error, it just doesnt find any files, because there isnt a directory with the name 'Arctic', 'Monkeys', '-', 'AM', '(2013)', or '[FLAC]', the folder is called 'Arctic Monkeys - AM (2013) [FLAC]' which is what I am passing as ARGV[0]]
<eam>
are you quoting it?
<ethe>
If I manually input 'Arctic\ Monkeys\ \-\ AM\ \(2013\)\ \[FLAC\]/**.flac' as the dir string it works fine
<ethe>
eam: I'm escaping the spaces, and characters
<eam>
aacify.rb "Arctic Monkeys - and so on "
djbkd has quit [Remote host closed the connection]
<eam>
ethe: in any event, glob() doesn't care about spaces
<ericli>
any ruby function works like die(); in perl?
<ericli>
encounter the error then throw out exceptions and exit
<eam>
ethe: raise
<eam>
ericli: ^^
<ethe>
running: ruby aacify.rb "Arctic\ Monkeys\ \-\ AM\ \(2013\)\ \[FLAC\]/" works just fine
djbkd has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
cgfbee has quit [Excess Flood]
<ericli>
eam, thanls
<eam>
ethe: well, [] is a glob metacharacter
<eam>
just like *
<ethe>
hmm that's a good point
B1n4r10 has quit [Ping timeout: 268 seconds]
Snowy has quit [Remote host closed the connection]
hahuang61 has quit [Ping timeout: 248 seconds]
rattatmatt has joined #ruby
cgfbee has joined #ruby
fexilal has quit [Ping timeout: 268 seconds]
krz has quit [Read error: Connection reset by peer]
moeabdol has joined #ruby
rmulligan has joined #ruby
df- is now known as df
last_staff has joined #ruby
jenrzzz has joined #ruby
djbkd has quit [Ping timeout: 248 seconds]
DoubleMalt has quit [Remote host closed the connection]
djbkd has joined #ruby
nocontrol has joined #ruby
moeabdol has quit [Ping timeout: 260 seconds]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
rehat has quit [Remote host closed the connection]
Musashi007 has quit [Quit: Musashi007]
Dimik has joined #ruby
minimalism has joined #ruby
nocontrol has quit [Ping timeout: 248 seconds]
Breaking_Pitt has joined #ruby
<ericli>
Ox0dea, yesterday we discussed that using open3 to capture stdout/stderr, however, seems the capture content is buffered, so is there any way I can see the output unbuffered?
<manveru>
ericli: you mean like IO#sync ?
<manveru>
you can set that to true to disable buffering
Es0teric has quit [Ping timeout: 248 seconds]
<ericli>
manveru, I don;t know what it is but I would like to see the unbuffered contents.
<manveru>
do that for your open3 si/so/se and your normal $stdout to see it in realtime
<ericli>
so any setting I can use?
sergey_makagon has joined #ruby
rodfersou is now known as rodfersou|afk
Breaking_Pitt has quit [Read error: Connection reset by peer]
smathy is now known as smathy_afk
Es0teric has joined #ruby
smathy_afk is now known as smathy
Es0teric has quit [Max SendQ exceeded]
<ericli>
and one more thing, when I use open3 to capture the output: Open3.capture2e("#{restore_cmd}") if the cmd needs my input and when I input something, seems the terminal is blocked
evidex has quit [Remote host closed the connection]
<ericli>
manveru, so is there any way that I can input something during the procedure and still see unbuffered contents?
baweaver has joined #ruby
elifoster has joined #ruby
andywojo has joined #ruby
<manveru>
well, you have to link the stdin of your terminal to the stdin of capture2e
<manveru>
otherwise you will fall on deaf ears
halfamind1 has quit [Read error: Connection reset by peer]
<ericli>
I just hope run the command and maybe I need to type something when the command prompts some to me.
halfamind has joined #ruby
rbennacer has quit []
nettoweb has quit [Read error: Connection reset by peer]
intrigueD has quit [Remote host closed the connection]
jschoolcraft has joined #ruby
<ericli>
manveru, okay, seems I can use system() to do that, correct?
<ericli>
btw, system() is also buffered for the output?
<manveru>
but you still want to capture the output of the command?
patrick-sartent has quit [Quit: .]
nettoweb has joined #ruby
Breaking_Pitt has joined #ruby
<ericli>
manveru, yes
<manveru>
system is buffered too by default
nocontrol has joined #ruby
<manveru>
it outputs on every newline
patrick-sartent has joined #ruby
chouhoul_ has joined #ruby
<ericli>
manveru, but when I use system() by default I should get the contents on my screen, right?
<manveru>
ruby -e 'system("read hi; echo hi = $hi")'
andywojo has quit [Ping timeout: 244 seconds]
<manveru>
try that for example
baweaver has quit [Ping timeout: 276 seconds]
<manveru>
ruby -e 'system("echo -n enter hi: ; read hi; echo hi = $hi")'
<manveru>
even nicer :)
rodfersou|afk is now known as rodfersou
chouhou__ has joined #ruby
rbennacer has joined #ruby
_blizzy_ has joined #ruby
<ericli>
yeah, let me try
<manveru>
in ruby you do it like: ruby -e 'print "enter hi: "; hi = gets; puts "hi = #{hi}"'
chouhoulis has quit [Ping timeout: 260 seconds]
joonty has quit [Ping timeout: 240 seconds]
<ericli>
manveru, right, so which one is for unbuffered settings?
<manveru>
but system basically spawns a new shell which has its own stdout/stderr/stdin
TheGreatGudsby has quit [Quit: You had my curiosity. But now you have my attention]
<manveru>
neither one
<manveru>
i highly doubt your issue is with buffering
TheGreatGudsby has joined #ruby
<manveru>
because even if it's buffered, it would display after a newline
<ericli>
manveru, you mentioned there's one setting I can change buffered to unbuffered.
<manveru>
yes, there is
nocontrol has quit [Ping timeout: 276 seconds]
JohnBat26|2 has quit [Read error: Connection reset by peer]
<manveru>
but maybe you can show the code first so i can see if that's the right approach?
<ericli>
manveru, that would be great
chouhoul_ has quit [Ping timeout: 260 seconds]
mistermocha has joined #ruby
JohnBat26|2 has joined #ruby
yeticry has quit [Remote host closed the connection]
yeticry has joined #ruby
Es0teric has joined #ruby
Es0teric has quit [Max SendQ exceeded]
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
smathy is now known as smathy_afk
smathy_afk is now known as smathy
mondok has joined #ruby
poguez_ has quit [Quit: Connection closed for inactivity]
floatingpoint has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
FooMunki has quit [Quit: FooMunki]
FooMunki has joined #ruby
Pupeno has joined #ruby
uglybandersnatch has quit [Ping timeout: 260 seconds]
SCHAAP137 has joined #ruby
polyidus has quit [Quit: Later]
<jottr>
Could someone have a look at how I use CSV.table.delete_if ? The way I do it now, I always end up with zero entries, which is wrong: https://git.io/vapVo
<jottr>
It's probably very trivial. Just can't see it right now
freerobby has quit [Quit: Leaving.]
<jottr>
Also, could this be made faster then N+1?
dopie has quit [Quit: Leaving]
polyidus has joined #ruby
mdw has joined #ruby
pawnbox has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
drewbro has joined #ruby
drew0 has quit [Ping timeout: 252 seconds]
agentmeerkat has joined #ruby
htmldrum_ has quit [Ping timeout: 250 seconds]
htmldrum has quit [Ping timeout: 260 seconds]
zenlot6 has joined #ruby
zenlot has quit [Ping timeout: 276 seconds]
pawnbox has quit [Ping timeout: 240 seconds]
astrobun_ has joined #ruby
<smathy>
jottr, = vs ==
jgpawletko has quit [Quit: jgpawletko]
<jottr>
smathy: ?
<jottr>
smathy: Hi, first of all. :)
<jottr>
smathy: Not sure I understand what you're trying to say there
<smathy>
jottr, take a guess.
Pumukel has quit [Quit: ChatZilla 0.9.92 [Firefox 45.0.1/20160315153207]]
yfeldblum has quit [Remote host closed the connection]
<jottr>
ah
<jottr>
doh
<smathy>
:)
astrobunny has quit [Ping timeout: 276 seconds]
<smathy>
We all do that.
last_staff has quit [Quit: last_staff]
<jottr>
Thx. It's been a long day and night and day...
<smathy>
jottr, you're welcome.
neanderslob_ has quit [Ping timeout: 248 seconds]
yfeldblum has joined #ruby
northfurr has joined #ruby
northfurr has quit [Client Quit]
polishdub has quit [Quit: Leaving]
Snowy has joined #ruby
moeabdol has quit [Quit: WeeChat 1.4]
jobewan has quit [Ping timeout: 244 seconds]
neanderslob_ has joined #ruby
Azure has joined #ruby
johnmilton has joined #ruby
hxegon has joined #ruby
tubuliferous has quit [Ping timeout: 252 seconds]
hxegon is now known as hxegon_AFK
stannard has quit [Ping timeout: 240 seconds]
hxegon_AFK is now known as hxegon
sepp2k has quit [Read error: Connection reset by peer]
polyidus has quit [Quit: Later]
TheNet has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sneakerhax has quit [Ping timeout: 268 seconds]
queequeg1 has quit [Ping timeout: 260 seconds]
baweaver has quit [Remote host closed the connection]
queequeg1 has joined #ruby
saneax_AFK is now known as saneax
floatingpoint has joined #ruby
ChiefAlexander has quit [Quit: Leaving...]
Noxilex has joined #ruby
drewbro has quit [Ping timeout: 244 seconds]
neanderslob_ is now known as neanderslob
polyidus has joined #ruby
mleung has quit [Quit: mleung]
codepete_ has joined #ruby
TheNet has joined #ruby
queequeg1 has quit [Ping timeout: 244 seconds]
rattatmatt has quit []
chipotle_ has joined #ruby
chipotle has quit [Read error: Connection reset by peer]
Azure has quit [Remote host closed the connection]
tvw has quit [Remote host closed the connection]
codepete_ has quit [Client Quit]
crowell has quit [Ping timeout: 248 seconds]
codepete has joined #ruby
TheNet has quit [Client Quit]
queequeg1 has joined #ruby
yfeldblum has quit [Remote host closed the connection]
ledestin has quit [Ping timeout: 250 seconds]
Azure has joined #ruby
pikajude has quit [Ping timeout: 248 seconds]
rmulligan has quit [Remote host closed the connection]
rmulligan has joined #ruby
intrigueD has quit [Remote host closed the connection]
nocontrol has quit [Remote host closed the connection]
rbennacer has quit [Remote host closed the connection]
neanderslob has quit [Read error: Connection reset by peer]
neanderslob_ has joined #ruby
drewbro has joined #ruby
queequeg1 has quit [Ping timeout: 244 seconds]
rbennacer has joined #ruby
baweaver has joined #ruby
pikajude has joined #ruby
pikajude has joined #ruby
neanderslob_ has quit [Read error: Connection reset by peer]
queequeg1 has joined #ruby
yfeldblum has joined #ruby
<smathy>
You changed from each...delete_if to delete_if...each - but the return of foo.each is foo
<smathy>
(which will be true)
razer_ has quit [Quit: Leaving...]
neanderslob_ has joined #ruby
<jottr>
smathy: Well both variants did not work. The commented-out version yielded the same result.
neanderslob_ is now known as neanderslob
mleung has joined #ruby
rbennacer has quit [Ping timeout: 264 seconds]
elifoster has joined #ruby
<smathy>
Oh, the error you mean?
<smathy>
Well, let's work through that.
<smathy>
What's it telling you?
<jottr>
Yes, the error. :)
tubuliferous has joined #ruby
ellistaa has joined #ruby
choke has joined #ruby
TheNet has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
crowell has joined #ruby
xpt has joined #ruby
<ellistaa>
im creating something similar to an amazon clone. im thinking since there are many items that ill use nosql for the items and rdb for users …. good idea?
piotr has joined #ruby
<jottr>
Well, that I'm trying to convert a string to integer, which does not work.
<smathy>
Right, and which line and where are you trying to do that?
<jottr>
13
<shevy>
"5".to_i # => 5
<shevy>
it works!
<piotr>
q
<smathy>
jottr, right, line 13 and the error tells you even more about where it's happening.
benlieb has quit [Quit: benlieb]
<jottr>
inside the array. so t['email'] does not return an array?
<smathy>
Nope, in []
<jottr>
erm string. i meannt
<smathy>
[] is just a method call in Ruby, and what's inside the []s is the argument to the method.
<ellistaa>
i guess the other option is to just use an rdb and have a field in item model that is of type json …
Balzrael has joined #ruby
<smathy>
So, on that line 13 you're calling [] in two places, and in both you're passing strings right?
<jottr>
yes
<smathy>
...and what is the error telling you Ruby is expecting?
<jottr>
...an Integer
<smathy>
jottr, so, for this sort of [] call, what could it possibly mean if Ruby is expecting an integer instead of a string for one of those two calls?
piotr has quit [Quit: WeeChat 1.4]
moos3 has joined #ruby
<jottr>
...hm. Not sure. That it expects an array position?
SCHAAP137 has quit [Quit: Leaving]
superfox_il_volp has joined #ruby
<smathy>
jottr, well, are you familiar with notation like: foo[1] as well as what you're using: foo['str'] ?
<jottr>
yes
<smathy>
jottr, and so if Ruby is expecting foo[1] (instead of foo['str']) then what does that mean foo is?
duncannz has joined #ruby
<superfox_il_volp>
hi, silly question, how do you output a string in an erb template from an enclosed block <% %> ? using <%= %> requires to exit from the <% %> block
<jottr>
an array of integers?
jrcharney has joined #ruby
<jottr>
no
<superfox_il_volp>
while print(x) sends its output into the stdout :/
<jottr>
god i'm just tired...
TheNet has joined #ruby
davedev24 has joined #ruby
intrigueD has joined #ruby
moos3 has quit [Ping timeout: 268 seconds]
jam_ has joined #ruby
intrigueD has quit [Remote host closed the connection]
<smathy>
superfox_il_volp, you close the %> and then open a <%=
<jrcharney>
I'm starting to think installing rubywith ruby-instal with the --system attribute (which installs ruby in /usr/local) may have been a bad idea. Any suggestions for how I can uninstall it and reinstall it into something like /opt/rubies?
jam_ has quit [Ping timeout: 268 seconds]
LoneHermit has quit [Ping timeout: 276 seconds]
jrcharney has quit [Quit: WeeChat 1.4]
jrcharney has joined #ruby
<jrcharney>
I think tree branch hit my phone line again
pawnbox has joined #ruby
TheNet has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
polyidus has quit [Quit: Later]
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
matp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
freerobby has joined #ruby
graffix has joined #ruby
m4tm4t has joined #ruby
RegulationD has quit [Remote host closed the connection]
m4tm4t has quit [Quit: leaving]
polyidus has joined #ruby
pawnbox has quit [Ping timeout: 276 seconds]
stunder001 has quit [Quit: WeeChat 1.4]
skade has quit [Quit: Computer has gone to sleep.]
hahuang65 has quit [Ping timeout: 240 seconds]
Moosashi has joined #ruby
toretore has joined #ruby
halfamind has joined #ruby
rmulligan has quit [Ping timeout: 248 seconds]
valetudo has quit [Ping timeout: 244 seconds]
bricker has joined #ruby
tubuliferous has quit [Ping timeout: 260 seconds]
Noxilex has quit [Ping timeout: 248 seconds]
halfamind has quit [Quit: Leaving.]
rmulligan has joined #ruby
superfox_il_volp has quit [Quit: Nettalk6 - www.ntalk.de]
firstdayonthejob has quit [Ping timeout: 252 seconds]