Ebok has quit [Quit: This computer has gone to sleep]
<marahin>
apeiros: and then extending the array *should* not raise the namespace error?
<apeiros>
marahin: correct
<marahin>
also no idea how to use the map really, and how would it be beneficient for the amount of data it's used right there
nando293921 has quit [Ping timeout: 244 seconds]
<apeiros>
marahin: maybe read the docs of map? what you do with your each_with_object in multithreaded_each is precisely what map does. but with less code and less overhead.
<marahin>
apeiros: I see. Well, the module itself is a SO snippet I found somewhere *some time ago*, back when I started fiddling with the bot :)
RegulationD has joined #ruby
<marahin>
thank you greatly for explanation
<apeiros>
I don't really need the reason why your code ended up like it is
<Ox0dea>
marahin: It can become `map { |e| Thread.new { yield e } }.each(&:join)`.
pwnd_nsfw has quit [Ping timeout: 268 seconds]
Moosashi has joined #ruby
r0bby_ has joined #ruby
robbyoconnor has quit [Read error: Connection reset by peer]
Vlat- has quit [Quit: Vlat-]
kareeoleez has joined #ruby
RegulationD has quit [Ping timeout: 276 seconds]
PaulCapestany has joined #ruby
statelesscode has quit [Quit: statelesscode]
davee_ has quit [Quit: Leaving]
moeabdol has joined #ruby
SCHAAP137 has quit [Quit: Leaving]
PaulCape_ has quit [Ping timeout: 244 seconds]
moeabdol has quit [Ping timeout: 250 seconds]
SilverKey has joined #ruby
marahin has left #ruby ["WeeChat 1.4"]
htmldrum has joined #ruby
mikecmpbll has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
djbkd has quit [Quit: My people need me...]
blaxter has quit [Quit: KTHXBYE]
ismaelga has quit [Remote host closed the connection]
ismaelga has joined #ruby
tubuliferous has quit [Ping timeout: 276 seconds]
stannard has joined #ruby
lkba_ has quit [Ping timeout: 252 seconds]
pibby has joined #ruby
Moosashi has quit [Quit: Moosashi]
diegoviola has joined #ruby
kareeoleez has quit [Remote host closed the connection]
stannard has quit [Ping timeout: 252 seconds]
dramagods has joined #ruby
bronson has joined #ruby
chipotle has quit [Quit: cheerio]
dramagods has quit [Ping timeout: 260 seconds]
Ebok has joined #ruby
saneax is now known as saneax_AFK
bronson has quit [Ping timeout: 252 seconds]
Madplatypus has joined #ruby
PaulCape_ has joined #ruby
PaulCapestany has quit [Ping timeout: 250 seconds]
theshrike has quit [Read error: Connection reset by peer]
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
finisherr has quit [Quit: finisherr]
finisherr has joined #ruby
finisherr has quit [Client Quit]
flashpoint9 has joined #ruby
icey has quit [Quit: No Ping reply in 180 seconds.]
babykosh has joined #ruby
sgambino has joined #ruby
icey has joined #ruby
<flashpoint9>
Im learning about using nokigiri for scarping sites, im working on a scraper that get a stock price from yahoo based on ticker information. When I hardcode the selector it works but if I try and make it dynamic by passing the ticker to it it returns nothing https://gist.github.com/JosephLeon/6b421790b3bd353945f80f31c687f34a
babykosh has quit [Client Quit]
<flashpoint9>
line 18 works
<flashpoint9>
but line 19 doesnt
<Ox0dea>
flashpoint9: The element's id contains a lowercase L, not a digit 1.
<Ox0dea>
Consider using a font that makes the distinction more apparent.
babykosh has joined #ruby
chipotle has joined #ruby
<flashpoint9>
Ox0dea: ah wow, total nub mistake on my part
babykosh has quit [Client Quit]
<flashpoint9>
thanks!
aghalarp has joined #ruby
jottr has quit [Ping timeout: 240 seconds]
davedev24 has quit []
zacts has quit [Quit: WeeChat 1.4]
p0p0pr37 has quit [Remote host closed the connection]
zacts has joined #ruby
PaulCapestany has joined #ruby
yfeldblum has quit [Ping timeout: 276 seconds]
PaulCape_ has quit [Ping timeout: 276 seconds]
jordanm has joined #ruby
aghalarp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
saneax_AFK is now known as saneax
p0p0pr37 has joined #ruby
PlasmaStar has quit [Ping timeout: 276 seconds]
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Vlat- has joined #ruby
Mia has quit [Read error: Connection reset by peer]
eaven has joined #ruby
zacstewart has joined #ruby
unreal has quit [Read error: Connection reset by peer]
<eaven>
Hello. I am trying to run a where query in rails 4.2 and when I run DateTime.current I am given "Sat, 30 Apr 2016 18:22:55 -0700" which is correct.. but when I use DateTime.current the query is being given Post Load (0.3ms) SELECT `posts`.* FROM `posts` WHERE (`posts`.`post_at` BETWEEN '2016-05-01 01:22:51' AND '2016-05-01 01:17:51')
<eaven>
I'm not sure why it's searching for tomorrows records when it outputs todays date when I test DateTime.current
<ruby[bot]>
eaven: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
<eaven>
yea, rails
<Ox0dea>
Yeah.
eaven is now known as Eaven
<Eaven>
I am identified
<Ox0dea>
Eaven: This is #ruby.
unreal has joined #ruby
<Eaven>
well I know that. figured someone might know as they kinda go hand in hand
<Eaven>
but i was joining #rails which wasnt working so yea now im in RoR
<bazz_>
if I have a class "A::B::C" and another class "A::B::D::E" -- where A,B,D are modules and C,E are classes ... is there anyway to write "relatively" `class E < A::B::D::E` ? I'm hoping to do something close to `class E < D::E`
flashpoint9 has quit [Remote host closed the connection]
<bazz_>
class C*
<bazz_>
In other words, if you want to access the parent namespace, can you do so relatively ... must it be absolute?
<apeiros>
bazz_: constant lookup depends on how you built your lexical context. if you have `module A; module B; C; end; end` then C will be searched in A::B::C, A::C and ::C
Vlat- has quit [Quit: Vlat-]
<apeiros>
if you have `module A::B; C; end`, then only A::B::C and ::C are searched
<bazz_>
OK I understand you!
<bazz_>
I will try it
PaulCape_ has joined #ruby
<apeiros>
and iirc it goes inside out. when in doubt, `p Module.nesting` will show you what's being searched at the point you execute that statement.
nando293921 has joined #ruby
PaulCapestany has quit [Ping timeout: 260 seconds]
ismaelga has quit [Remote host closed the connection]
<bazz_>
Thank apeiros
madgen has quit [Ping timeout: 250 seconds]
phoo1234567 has quit [Quit: Leaving]
<Ox0dea>
apeiros: Thank you.
<apeiros>
o0
hfp has joined #ruby
<apeiros>
you're both welcome. even if Ox0dea's came unexpected
crystal77 has joined #ruby
hfp_work has joined #ruby
<Ox0dea>
I thought we were playing Simon Says.
<Ox0dea>
(Which I apparently don't know how to play.)
<apeiros>
you can play "keep talking and nobody explodes", it's got a "simon says" module…
<apeiros>
haven't. only watched humans play. was fun.
chipotle has quit [Quit: cheerio]
Vlat- has joined #ruby
Moosashi has quit [Quit: Moosashi]
dramagods has quit [Ping timeout: 276 seconds]
mlakewood has joined #ruby
smathy is now known as smathy_afk
nerium has quit [Quit: nerium]
nerium has joined #ruby
madgen has joined #ruby
dramagods has joined #ruby
nerium has quit [Client Quit]
Vlat- has quit [Quit: Vlat-]
tristanp has joined #ruby
tristanp has quit [Remote host closed the connection]
tristanp has joined #ruby
mlakewood has quit [Quit: mlakewood]
dramagods has quit [Ping timeout: 240 seconds]
PaulCapestany has joined #ruby
gizless has joined #ruby
billy12 has joined #ruby
stannard has joined #ruby
PaulCape_ has quit [Ping timeout: 276 seconds]
moeabdol has joined #ruby
gizmore has quit [Ping timeout: 240 seconds]
stannard has quit [Ping timeout: 240 seconds]
RegulationD has joined #ruby
moeabdol has quit [Ping timeout: 250 seconds]
<bazz_>
is it possible to "template" a parent class's class variables such that classes that extend from it can somehow provide input to the class variables. and I can elaborate
<Ox0dea>
bazz_: You have to use a Proc to defer evaluation.
<bazz_>
I don't think so (going to create an experiment)
<bazz_>
I'll try a non-destructive prepend (addition?)
Liothen has quit [Changing host]
Liothen has joined #ruby
<Ox0dea>
Yeah, that'd do.
<bazz_>
:) yay it works as desired now
<Ox0dea>
\o/
opus_ has joined #ruby
chipotle has joined #ruby
tristanp has quit [Ping timeout: 260 seconds]
crystal77 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
noService has quit [Ping timeout: 246 seconds]
ismaelga has joined #ruby
johnmilton has joined #ruby
houhoulis has quit [Remote host closed the connection]
PaulCape_ has joined #ruby
<bazz_>
now if I can only find a way to automate the creation of the altered constant (subclass)
<bazz_>
given the input string to prepend somehow
<bazz_>
I could probably figure a way to do it using the `inherited` hook
chouhoulis has quit [Remote host closed the connection]
PaulCapestany has quit [Ping timeout: 276 seconds]
dnewkerk has quit [Quit: dnewkerk]
johnmilton has quit [Ping timeout: 244 seconds]
<bazz_>
but that would require turning some stuff into a module and I cannot simple fathom the mixture
<bazz_>
ideally I specify the prepend_str as in the subclass definition, which creates constants automatically based on parent class constants prepended with the subclass prepend_str
solocshaw has joined #ruby
<Ox0dea>
bazz_: #inherited is for Class; why do you think you'd need to switch to a Module?
<bazz_>
yeah I just learned this .. need to use self.inherited and not just `inherited` (which I assume is for modules)
bronson has joined #ruby
<bazz_>
still I am having issues assigning the sub-class constant based on a sub-class constant .. this could be because the subclass is not fully defined at the time of hook execution?
<bazz_>
I can create another gist to show it in full
<Ox0dea>
Go for it.
<bazz_>
wait.. almost got it...
<bazz_>
(solving on my own)
<bazz_>
nope ..
<bazz_>
what's the proper way to externally modify class const?? Must I create an attr_writer ??
<bazz_>
I doubt that
scott_o has joined #ruby
<Ox0dea>
bazz_: #const_set is a thing.
<bazz_>
ugh heheh :]
bronson has quit [Ping timeout: 252 seconds]
CloCkWeRX has joined #ruby
<bazz_>
oh no.. I can't get the const form the child from inside `inherited` :[
<bazz_>
from*
<bazz_>
uninitialized constant :[
elifoster has joined #ruby
<Ox0dea>
Er, do you need to?
terminalrecluse has joined #ruby
dopie has quit [Quit: Lost terminal]
mlakewood has joined #ruby
dopie has joined #ruby
binaryplease1 has joined #ruby
dopie has quit [Client Quit]
<bazz_>
that's the whole idea .. the whole idea is to create alterations of parent-class const/var based on a sub-class const/variable -- and they will belong to the subclass
<Ox0dea>
bazz_: Ah, well, you won't be able to do it with plain-old inheritance, then.
Spami has joined #ruby
binaryplease has quit [Ping timeout: 250 seconds]
dopie has joined #ruby
skweek has quit [Ping timeout: 276 seconds]
dopie has quit [Client Quit]
hdm has joined #ruby
Spami has quit [Quit: This computer has gone to sleep]
<hdm>
what are folks using these days to build bog-standard signup/register/verify portals? rails + devise?
<bazz_>
Ox0dea, are there any hooks I can place in the subclass?
theshrike has joined #ruby
<Ox0dea>
bazz_: Afraid not. The only thing that comes to mind just now is setting up a TracePoint for the :end event, but that's disgusting.
<Ox0dea>
You'll just have to invoke some method at the end of your class body if you really want to do it this way. :/
<bazz_>
Ox0dea, sorry what I said to you last night -- I just see Ruby has some sort of `prepended` hook ... not sure what it would do .. never heard of that sort of thing before in other OOP languages
binaryplease1 is now known as binaryplease
stardiviner has quit [Ping timeout: 246 seconds]
<Ox0dea>
bazz_: Ruby *doesn't* have a #prepended hook (yet).
<Ox0dea>
Which is anomalous given the existence of #included and #extended.
<Ox0dea>
It's `using` for which there isn't yet a hook.
madgen has quit [Ping timeout: 252 seconds]
<Ox0dea>
The refinements mechanism still has a few kinks to be ironed out, and I forget the one use case I'd've had for Module#used or the like, but I still think it should exist for the sake of symmetry.
<Ox0dea>
bazz_: Module#prepend sticks its argument at the very front of the receiver's ancestor chain, ensuring that it gets first dibs at method resolution.
<bazz_>
I understand
dramagods has joined #ruby
<bazz_>
is there any equivalent of the desired self.initialize ??
opus_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0dea>
I'm not sure I follow.
<Ox0dea>
#initialize is an instance method unless you're doing something weird.
<bazz_>
exactly .. I want a class equivalent ..
<bazz_>
as "class initialized or defined.. run this code now!!"
rbennacer has joined #ruby
<Ox0dea>
bazz_: That'd be the TracePoint option.
<Ox0dea>
There's no way to hook the end of a class body, only the beginning.
<Ox0dea>
But TracePoint allows you to watch for just that kind of event and respond however you will.
<bazz_>
sounds dirty as you said
P_R_Deltoid has joined #ruby
<Ox0dea>
Oui.
<bazz_>
I guess I'll have to add a function call in the middle of the class definition :|
<bazz_>
there's gotta be a better way
<Ox0dea>
If you want dynamic constants based on existing constants, those latter constants simply have to exist before you can get started...
dramagods has quit [Ping timeout: 250 seconds]
dopie has joined #ruby
elgatorapido has joined #ruby
braincrash has quit [Quit: bye bye]
elgatorapido has quit [Client Quit]
<Radar>
?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
ropeney has quit [Remote host closed the connection]
<bazz_>
so then let me get this straight - with the context of my question in mind - is that instance variable .. what is its scope ? and "access-point" ?
<Ox0dea>
It belongs to C.
<Ox0dea>
It is directly accessibly only by C.
<Ox0dea>
There's #instance_variable_get for poking around in the guts of any Object, though.
<bazz_>
and what's the difference between @tp and if it was `@@tp` instead
scott_o has quit []
<Ox0dea>
If it were the latter, it'd be directly accessible (and modifiable!) by subclasses.
<Ox0dea>
Honestly, it probably should've been a constant, but let's not take that monstrosity too seriously. :P
zacstewart has quit [Ping timeout: 260 seconds]
hdm has left #ruby [#ruby]
chipotle has joined #ruby
<Ox0dea>
TracePoints themselves aren't scoped in any meaningful sense, so it's almost disingenuous to not just stick them in a global.
theshrike has quit [Quit: Leaving]
gix has quit [Ping timeout: 260 seconds]
Madplatypus has quit [Quit: Connection closed for inactivity]
theshrike has joined #ruby
eljimador has quit [Read error: Connection reset by peer]
gix has joined #ruby
eljimmy has joined #ruby
htmldrum has quit [Ping timeout: 252 seconds]
htmldrum has joined #ruby
sgambino has joined #ruby
Nanuq has quit [Ping timeout: 264 seconds]
htmldrum has quit [Ping timeout: 252 seconds]
ensyde has joined #ruby
scarygelatin has joined #ruby
LoneHerm_ has quit [Remote host closed the connection]
LoneHerm_ has joined #ruby
stardiviner has joined #ruby
devbug has quit [Quit: ZZZzzz…]
Nanuq has joined #ruby
dh64 has joined #ruby
<bazz_>
is it normal to reassign variables that were formerly "new objects" ?? I need not "free" those objects or anything?
<Radar>
bazz_: Do you have an example?
<bazz_>
garbage collector will take care of it?
<bazz_>
yeah sure ..
<Ox0dea>
As long as you don't have mysterious references keeping the object alive, yeah.
<bazz_>
oh gawd I hope I don't
mlakewood has quit [Quit: mlakewood]
devbug has joined #ruby
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
zzak has quit [Remote host closed the connection]
zzak has joined #ruby
augustomna2010 has joined #ruby
Eaven has left #ruby [#ruby]
chosen1 has joined #ruby
dramagods has joined #ruby
stannard has joined #ruby
x77686d has joined #ruby
rbennacer has quit [Remote host closed the connection]
Denart_ has quit [Remote host closed the connection]
stannard has quit [Ping timeout: 240 seconds]
dramagods has quit [Ping timeout: 260 seconds]
<gizless>
Is 'The Last Unicorn' for girls only?!
RegulationD has joined #ruby
PedramT has joined #ruby
RegulationD has quit [Ping timeout: 260 seconds]
brianpWins has joined #ruby
LoneHerm_ has quit [Remote host closed the connection]
The_Phoenix has joined #ruby
The_Phoenix has quit [Max SendQ exceeded]
augustomna2010 has quit [Remote host closed the connection]
PedramT has quit [Remote host closed the connection]
The_Phoenix has joined #ruby
The_Phoenix has quit [Max SendQ exceeded]
noService has joined #ruby
The_Phoenix has joined #ruby
The_Phoenix has quit [Max SendQ exceeded]
augustomna2010 has joined #ruby
The_Phoenix has joined #ruby
The_Phoenix has quit [Max SendQ exceeded]
Spami has joined #ruby
The_Phoenix has joined #ruby
iaglium has quit [Max SendQ exceeded]
noService has quit [Ping timeout: 276 seconds]
diegoviola has quit [Quit: WeeChat 1.4]
aghalarp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
theshrike has quit [Quit: Leaving]
silentpost has quit [Ping timeout: 246 seconds]
<bazz_>
is there a "scalable" way to check if a file has a trailing newline?
chouhoulis has joined #ruby
James123 has quit [Quit: Lost terminal]
sgambino has quit [Ping timeout: 260 seconds]
hk238 has joined #ruby
hagarelvikingo has joined #ruby
duckpuppy has quit [Ping timeout: 244 seconds]
tlolczyk has joined #ruby
moeabdol has quit [Ping timeout: 276 seconds]
chouhoulis has quit [Ping timeout: 240 seconds]
rbennacer has quit [Remote host closed the connection]
bronson has joined #ruby
LoneHermit has joined #ruby
bronson has quit [Ping timeout: 252 seconds]
arescorpio has joined #ruby
yfeldblum has quit [Ping timeout: 276 seconds]
<gizless>
"\\n no
jenrzzz has joined #ruby
devbug has quit [Quit: ZZZzzz…]
statelesscode has joined #ruby
emilford has quit [Ping timeout: 260 seconds]
d0lph1n98 has quit [Ping timeout: 250 seconds]
dramagods has joined #ruby
fedexo has joined #ruby
<nofxxxx>
bazz_, iirc you can read only a few bytes of a file, and offset this to parallelize
genpaku has quit [Ping timeout: 250 seconds]
yokel has quit [Ping timeout: 276 seconds]
gigetoo has quit [Ping timeout: 260 seconds]
yokel has joined #ruby
<nofxxxx>
but... couldn;t you just delegate that issue to ag? (silver searcher)
genpaku has joined #ruby
dramagods has quit [Ping timeout: 244 seconds]
zacstewart has joined #ruby
gigetoo has joined #ruby
<bazz_>
I think maybe I'm taking the issue too seriously .. i just am dealing with dictionary files in the < 10 MB range .. and it's just a personal project ..
<bazz_>
need to check if the last byte is a newline .. or must manually append it proper
<bazz_>
I'll just file File.open and IO seek -1 (will try anyways)
<nofxxxx>
bazz_, yeah... you fallen into the "early optimization root of all evil stuff"
<nofxxxx>
=D
<bazz_>
yeah and I'm even conscious of premature optimization!! It's hard for me :|
<nofxxxx>
also, if it fits in ram it'll be fast... don't worry
<bazz_>
ok and furthermore .. is it possible to read and append to file in a single block?
zacstewart has quit [Ping timeout: 240 seconds]
bronson has joined #ruby
ReK2 has quit [Quit: Konversation terminated!]
<bazz_>
sorry, I can RTFM :)
<bazz_>
`a+` it is
<nofxxxx>
bazz_, guess so... check the options, there's 'r', 'w'... 'r+'... file I/O is something I always need the... you beat me to it
<nofxxxx>
bazz_, yeah, append! if it's always the ending it's perfect for you
htmldrum has joined #ruby
<bazz_>
heh I've been appending ;) -- but if the file does not have a trailing new line, I wind up appending to the last pre-existing line
<nofxxxx>
bazz_, and it doesn't need to be in the same block, if you don't use any block
<nofxxxx>
file will remain open
<nofxxxx>
eg f = File.open(....
<bazz_>
well a+ will give me read/write block anyways
<bazz_>
local variables are lexically scoped (even in re-opening the same class), instance variables in a class definition are available across re-opening of the class .. and are not available to subclasses ... and then finally class variables are available "across the board" (nested inheritance applicable)
<bazz_>
to be clearer, local variables are not available across re-opening of the same class (cause they are lexically scoped)
Utilisateur has quit [Quit: Quitte]
tubuliferous has quit [Ping timeout: 244 seconds]
akem has joined #ruby
emilford has joined #ruby
<lxsameer>
when is the last stage before generating bytecode from AST in source code ?
Ebok has quit [Quit: This computer has gone to sleep]
zacstewart has joined #ruby
tubuliferous has joined #ruby
antgel has joined #ruby
emilford has quit [Ping timeout: 260 seconds]
<shevy>
so difficult questions :)
zacstewart has quit [Ping timeout: 276 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
phredus has joined #ruby
benlieb has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
dudepare has quit [Ping timeout: 252 seconds]
PedramT has quit [Remote host closed the connection]
PedramT has joined #ruby
P_R_Deltoid has quit [Read error: Connection reset by peer]
<lxsameer>
shevy: I see, there was a function which process the AST and generated the byte code but i can't remember what it was
idefine has joined #ruby
<al2o3-cr>
lxsameer: ripper?
<lxsameer>
al2o3-cr: no I meant the C function
<al2o3-cr>
oh, lol
akem has quit [Ping timeout: 252 seconds]
idefine has quit [Read error: Connection reset by peer]
statelesscode has quit [Quit: statelesscode]
idefine has joined #ruby
PedramT_ has joined #ruby
firstdayonthejob has joined #ruby
nobitanobi has quit [Remote host closed the connection]
Devalo has joined #ruby
PedramT has quit [Ping timeout: 244 seconds]
PaulCape_ has joined #ruby
firstdayonthejob has quit [Quit: WeeChat 1.4]
stardiviner has quit [Quit: Code, Sex, Just fucking world.]
PaulCapestany has quit [Ping timeout: 252 seconds]
LoneHermit has joined #ruby
toretore has joined #ruby
LoneHermit has quit [Ping timeout: 244 seconds]
The_Phoenix has quit [Ping timeout: 276 seconds]
The_Phoenix has joined #ruby
ta_ has joined #ruby
PedramT_ has quit [Remote host closed the connection]
PedramT has joined #ruby
cu9t has joined #ruby
<cu9t>
how would you filter from two arrays and only show the value that's not in one of the arrays
terminalrecluse has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gizmore has joined #ruby
gizmore|2 has quit [Ping timeout: 252 seconds]
PedramT has quit [Remote host closed the connection]
futilegames has joined #ruby
PedramT has joined #ruby
chouhoulis has joined #ruby
futilegames has quit [Ping timeout: 252 seconds]
dionysus69 has quit [Ping timeout: 250 seconds]
fedexo has quit [Ping timeout: 250 seconds]
akem has joined #ruby
chouhoulis has quit [Ping timeout: 276 seconds]
PedramT has quit [Remote host closed the connection]
Meow-J has quit [Quit: Connection closed for inactivity]
ramfjord has quit [Ping timeout: 260 seconds]
antgel has joined #ruby
Moosashi has quit [Quit: Moosashi]
CausaMortis has joined #ruby
skade has joined #ruby
PedramT has quit [Ping timeout: 246 seconds]
chouhoulis has joined #ruby
chouhoulis has quit [Ping timeout: 260 seconds]
neanderslob has quit [Read error: Connection reset by peer]
idefine has quit [Remote host closed the connection]
m_abdelfattah has joined #ruby
Devalo has quit [Remote host closed the connection]
d0lph1n98 has quit [Ping timeout: 276 seconds]
PedramT has joined #ruby
emilford has joined #ruby
elaptics`away is now known as elaptics
PedramT has quit [Ping timeout: 260 seconds]
m_abdelfattah has quit [Ping timeout: 276 seconds]
akem has joined #ruby
ruby870 has joined #ruby
ruby870 has quit [Client Quit]
stoodfarback has joined #ruby
ruby-lang000 has joined #ruby
ruby-lang000 has quit [Client Quit]
emilford has quit [Ping timeout: 250 seconds]
skade has quit [Ping timeout: 260 seconds]
<shevy>
yo harry111
webus has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
tubuliferous has quit [Ping timeout: 260 seconds]
Sammichmaker has quit [Read error: Connection reset by peer]
<stoodfarback>
Hello all. I'm looking for the name of an algorithm (or ruby gem). I have a background task that does a ton of things in sequence (say, 20k). Some are near-instant, some take a while. I want to show updates to the user ("234/20,000: it.jpg") and also want to limit the updates to about 1 per second, since in some cases, hundreds can complete in seconds.
PedramT has joined #ruby
Meow-J has joined #ruby
<stoodfarback>
I need the part that limits it to one per second, everything else already works.
d0lph1n98 has joined #ruby
<Zarthus>
stoodfarback: are you sure showing completion in percentage is not more efficient?
dramagods has joined #ruby
tildes has joined #ruby
<stoodfarback>
Zarthus: Yep, fairly sure. If it takes a long time on a specific item/step, I want it to be showing what item/step that is.
robbyoconnor has joined #ruby
<Zarthus>
well I'm a bit confused on how you say "limit the updates to about 1 per second", if there's 20,000 entries, that'd take 20000 seconds
<stoodfarback>
Which is the reason I can't just store the time since last message and discard any more if it hasn't been a second. It would show the incorrect item if it takes a long time after a burst.
PedramT has quit [Ping timeout: 260 seconds]
<stoodfarback>
Zarthus: The items take different amounts of time to complete. Some can be done in 0.00001 seconds, some take minutes.
<Zarthus>
sounds to me like you just want two different things. one of them is the completion meter, the other is a list of completed items your interface loops through every second
<Zarthus>
that's how I'd go about making sure every entry (although that will still take a very long time) is shown to the user
<Zarthus>
personally, I don't see the value in it and showing it in realtime would be better (users tend to get confused easily regardless)
dramagods has quit [Ping timeout: 246 seconds]
stannard has joined #ruby
tildes has quit [Ping timeout: 260 seconds]
<stoodfarback>
That's the thing, Zarthus. I don't want to show 1000 items if they completed. I want to show what it's working on now.
<Zarthus>
but you also don't want to skip the remainder 999 if they all complete very fast?
<stoodfarback>
No, skip them.
* Zarthus
is very confused.
RegulationD has joined #ruby
<stoodfarback>
Here's the general idea: I want to save the "current" state to the db, without saving to db 1000 times if the state changed 1000 times in a second.
blaxter has joined #ruby
<Zarthus>
ah, right
mikecmpbll has joined #ruby
bronson has joined #ruby
stannard has quit [Ping timeout: 240 seconds]
skade has joined #ruby
marius has joined #ruby
roshanavand has joined #ruby
RegulationD has quit [Ping timeout: 240 seconds]
blackgoat has joined #ruby
<Zarthus>
I'd personally look into threading, I'm not sure if it is your best solution but I would need to see how your code works before giving better solutions
<Zarthus>
the other solution I can think of is to show an item from in the future instead of the current one
bronson has quit [Ping timeout: 252 seconds]
cpup has quit [Ping timeout: 244 seconds]
cpup has joined #ruby
Lomex has joined #ruby
TomyLobo has joined #ruby
kareeoleez has joined #ruby
lxsameer has quit [Ping timeout: 244 seconds]
a143753 has joined #ruby
<toretore>
stoodfarback: so you have a series of events at various intervals, sometimes less than and sometimes more than 1 second, and you want to basically sample the stream every second and display the event if it's different from the last?
roshanavand has quit [Read error: Connection reset by peer]
ReK2 has quit [Remote host closed the connection]
<stoodfarback>
toretore: Yep.
roshanavand has joined #ruby
ReK2 has joined #ruby
PedramT has joined #ruby
<toretore>
stoodfarback: and how is this implemented right now?
<stoodfarback>
toretore: Saving to db every time the state changes.
nobitanobi has joined #ruby
<toretore>
how do you know when the state changes?
kareeoleez has quit [Ping timeout: 260 seconds]
<stoodfarback>
Every second, grab the value in the db.
LoneHermit has quit [Remote host closed the connection]
ta_ has quit [Remote host closed the connection]
<toretore>
which sounds like it should work fine? is the issue that you want to filter the events before the db write?
skade has quit [Ping timeout: 252 seconds]
dangerousdave has joined #ruby
<stoodfarback>
Nah, that works. The issue is, some things take a small fraction of a second, and writing to the db each time is slowing it down a lot. Without saving state to db, it can do thousands per second, with saving state each time it's much slower.
PedramT has quit [Ping timeout: 276 seconds]
<toretore>
right
duckpuppy has joined #ruby
<toretore>
so you need to put a filter in between the work loop and the db write
PedramT has joined #ruby
<toretore>
that keeps track of time and the last state
nanoz has joined #ruby
Devalo has joined #ruby
<toretore>
something like `t, s = Time.now, nil; write = ->(state){ if state != s && Time.now > (t+1); write_to_db; end }`
chouhoulis has joined #ruby
<stoodfarback>
Yep, that's the straigtforward solution. But, it would cause the incorrect state to be displayed if it ever slows down (it does). Ie. it will discard the latest state, which is the only important one.
<toretore>
how so? it won't write the state unless it changes
PedramT has quit [Ping timeout: 250 seconds]
<toretore>
and it's been >1s since the last write
nobitanobi has quit [Remote host closed the connection]
johnDoe111^ has quit [Ping timeout: 246 seconds]
<stoodfarback>
Hmm... example: [0.001s: one] [0.002s: two] [40.0s three]. If it's sampled at second 5, it will show "one", and it needs to show what's actually taking so long, which is "two".
<shevy>
what is that... a hash or array?
johnDoe111 has quit [Ping timeout: 260 seconds]
<toretore>
right..
chouhoulis has quit [Ping timeout: 252 seconds]
Devalo has quit [Remote host closed the connection]
harry111 has quit [Ping timeout: 276 seconds]
<toretore>
ok so you have to always keep the current event in memory and then query that for the write
roshanavand has quit [Read error: Connection reset by peer]
roshanavand has joined #ruby
<toretore>
but then you have to implement something that runs every second regardless of events
roshanavand has quit [Client Quit]
skade has joined #ruby
moeabdol has quit [Ping timeout: 260 seconds]
domgetter has joined #ruby
<toretore>
event = nil; Thread.new{ cur = event; loop{ write_to_db(event) if event != cur; cur = event; sleep 1 } }; loop{ event = sleep rand }
<toretore>
with some locking, probably
johnDoe111 has joined #ruby
johnDoe111^ has joined #ruby
harry111 has joined #ruby
emilford has joined #ruby
<stoodfarback>
Yeah, seems like something like that should work. However, I am honestly not very good with concurrency, and would prefer to avoid writing it myself if possible. This seems like a fairly basic/standard application of concurrency, so I was hoping that there was a name/gem for it.
lxsameer has joined #ruby
PedramT has joined #ruby
<toretore>
unfortunately, generic abstractions for concurrency are not very common.. it kind of seeps through everywhere to the point that you have to understand the details to make use of it
emilford has quit [Ping timeout: 244 seconds]
skade has quit [Ping timeout: 276 seconds]
karapetyan has quit [Remote host closed the connection]
PedramT has quit [Ping timeout: 244 seconds]
Devalo has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
Devalo has quit [Remote host closed the connection]
d0lph1n98 has quit [Ping timeout: 260 seconds]
<Caerus>
stoodfarback, why not simply have a job check on the state of the event every second? if it's stuck @ one of those 40s tasks it would take 1 second to update
scepticulous has joined #ruby
duncannz has quit [Remote host closed the connection]
<stoodfarback>
Caerus: That's roughly the same thing toretore proposed. Same problem: dealing with threads/concurrency, which I am not good with.
skade has joined #ruby
nfk has joined #ruby
<Caerus>
oh, nvm I missread his reply
karapetyan has joined #ruby
isxek has joined #ruby
<stoodfarback>
Thank you all for the help though. I'll probably just bite the bullet and fumble around until the threads mostly do what I want, like usual.
lkba has joined #ruby
roshanavand has joined #ruby
nofxx has joined #ruby
johnDoe111^ has quit [Remote host closed the connection]
<shevy>
threads can be really annoying
<Caerus>
I wonder if you can process it to something like redis (memory is really fast) then do a bulk write to db or rollback redis writes lol
PedramT has joined #ruby
<shevy>
in ruby-gtk, I had a script that constantly changes the main buffer of a text-view widget; ascii animations. But there was a bug and I did not know where... that's when I found Thread.abort_on_exception = true which actually helped. But I did not know that before
johnDoe111^ has joined #ruby
<Caerus>
shevy, was it you that linked some history about a guy fighting his way into finally finding a ruby bug with threads?
johnDoe111^ has quit [Remote host closed the connection]
spider-mario has joined #ruby
Devalo has joined #ruby
johnDoe111^ has joined #ruby
Devalo has quit [Remote host closed the connection]
<nfk>
what's a good alternative to capistrano?
johnDoe111^^ has joined #ruby
<nfk>
i have almost gotten it working but i'm not sure i can push through with it to really working
PedramT has quit [Remote host closed the connection]
<Caerus>
nfk, Ansible maybe?
augustomna2010 has quit []
<shevy>
Caerus hmm not sure... I think it sounds familiar but it was probably someone else here... I vaguely remember that discussion though, or a similar one hmm
<shevy>
oh
<shevy>
a blog entry it was I think
<Caerus>
yeah i remember
<Caerus>
an actual bug on ruby
<shevy>
haha yeah... I forgot which one it was though :)
<Caerus>
child process dying and parent not catching up
<Caerus>
things slowing down
d0lph1n98 has joined #ruby
PedramT has joined #ruby
kareeoleez has joined #ruby
karapetyan has quit [Remote host closed the connection]
aghalarp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
idefine has joined #ruby
banister has joined #ruby
rbennacer has joined #ruby
PedramT has joined #ruby
emilford has joined #ruby
mikecmpbll has joined #ruby
idefine has quit [Ping timeout: 252 seconds]
PedramT has quit [Remote host closed the connection]
PedramT has joined #ruby
dling has quit []
askhat has joined #ruby
PedramT_ has joined #ruby
Devalo has joined #ruby
Devalo has quit [Remote host closed the connection]
sdothum has joined #ruby
emilford has quit [Ping timeout: 244 seconds]
CausaMortis has quit [Ping timeout: 276 seconds]
lkba_ has quit [Ping timeout: 260 seconds]
PedramT has quit [Ping timeout: 260 seconds]
PedramT_ has quit [Remote host closed the connection]
PedramT has joined #ruby
Elysia has quit [Remote host closed the connection]
Elysia has joined #ruby
PedramT has quit [Remote host closed the connection]
PedramT has joined #ruby
dionysus69 has joined #ruby
<awer>
hi im receiving an error when im running my code. i wonder if csomeone mught be able to point me in the rigth direction? https://paste.ee/p/1Nipr
<awer>
i want to run a curl command with a set of useragents to be run from a file one by one. nothing special
tildes has joined #ruby
<Ox0dea>
awer: File.open with a block is already giving you lines; why are you using #gets?
<awer>
Ox0dea: just trying doffernt ideas
<awer>
Ox0dea: i dont need the #gets part at all?
<Ox0dea>
awer: Er, sorry, you'll need File.each_line rather than File.open, but no, you don't need to obtain lines from standard input if you're already getting them from the input file.
<awer>
Ox0dea: could you possibly modify it on my ehalf so i can see what you mean exactly please?
<Ox0dea>
awer: I'm sorry, Dave. I'm afraid I can't do that.
<awer>
Ox0dea: if i change File.open to File.each_line and re run it i get - ./1.rb:4:in `<main>': undefined method `each_line' for File:Class (NoMethodError)
<Ox0dea>
awer: Derp. Make that File.foreach, and you should be golden.
n008f4g_ has quit [Ping timeout: 276 seconds]
PedramT has quit [Remote host closed the connection]
PedramT has joined #ruby
<p1k>
does anyone have experience compiling ruby for use with valgrind ?
harry111 has quit [Quit: Leaving]
banister has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
banister has joined #ruby
banister has quit [Client Quit]
PedramT has quit [Ping timeout: 240 seconds]
moeabdol has joined #ruby
<awer>
Ox0dea: thanks for your help
<Ox0dea>
awer: No worries.
<Ox0dea>
awer: Be advised that it'd probably be better to just accept a filename as a command-line argument; then you could just use the `while line = gets` idiom.
skade has quit [Quit: Computer has gone to sleep.]
a143753 has quit [Read error: Connection reset by peer]
<awer>
Ox0dea: thanks for the advice but that means absolutley nothing to me :-) im sure it will latter on down the line though
<shevy>
hehe
thesheff17 has joined #ruby
moeabdol has quit [Ping timeout: 252 seconds]
flashpoint9 has joined #ruby
skade has joined #ruby
FooMunki has quit [Read error: Connection reset by peer]
moeabdol has joined #ruby
pawnbox has quit [Remote host closed the connection]
kareeoleez has joined #ruby
Lomex has quit [Remote host closed the connection]
gregf has quit [Quit: WeeChat 1.4]
n008f4g_ has joined #ruby
skade has quit [Ping timeout: 276 seconds]
godzillaenlacasa has joined #ruby
mwlang has joined #ruby
gregf has joined #ruby
chouhoulis has joined #ruby
skade has joined #ruby
PedramT has joined #ruby
nobitanobi has joined #ruby
Macaveli has joined #ruby
gizless has joined #ruby
gizmore has quit [Ping timeout: 240 seconds]
chouhoulis has quit [Ping timeout: 260 seconds]
PedramT has quit [Remote host closed the connection]
PedramT has joined #ruby
PedramT has quit [Remote host closed the connection]
elgatorapido has joined #ruby
FooMunki has joined #ruby
roadt_ has joined #ruby
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
solars has quit [Ping timeout: 250 seconds]
LoneHermit has joined #ruby
emilford has joined #ruby
emilford has quit [Ping timeout: 240 seconds]
silentpost has joined #ruby
kareeoleez has quit [Remote host closed the connection]
LoneHermit has quit [Ping timeout: 252 seconds]
ItSANgo has quit [Quit: Leaving...]
zacstewart has joined #ruby
Guest49 has joined #ruby
awer has quit [Ping timeout: 260 seconds]
awer has joined #ruby
bobbycvi has quit [Ping timeout: 244 seconds]
zacstewart has quit [Ping timeout: 260 seconds]
bobbycvi has joined #ruby
elgatorapido has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
idle_task has joined #ruby
bobbycvi has quit [Client Quit]
bobbycvi has joined #ruby
godzillaenlacasa has quit [Quit: ZZZZZ....]
skade has quit [Quit: Computer has gone to sleep.]
bobbycvi has quit [Max SendQ exceeded]
idletask has quit [Ping timeout: 246 seconds]
stannard has joined #ruby
lxsameer has quit [Quit: WeeChat 1.4]
RegulationD has joined #ruby
bobbycvi has joined #ruby
nobitanobi has quit [Remote host closed the connection]
moeabdol has quit [Ping timeout: 250 seconds]
stannard has quit [Ping timeout: 240 seconds]
kareeoleez has joined #ruby
RegulationD has quit [Ping timeout: 250 seconds]
zacstewart has joined #ruby
awer has quit [Ping timeout: 250 seconds]
nobitanobi has joined #ruby
awer has joined #ruby
PedramT has joined #ruby
PedramT_ has joined #ruby
PedramT has quit [Read error: Connection reset by peer]
triangles has joined #ruby
triangles2 has quit [Ping timeout: 240 seconds]
qba73 has joined #ruby
statelesscode has joined #ruby
solocshaw has joined #ruby
nhhc has joined #ruby
mwlang has quit [Quit: mwlang]
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ex0ns has quit [Remote host closed the connection]
karapetyan has quit [Remote host closed the connection]
madgen has joined #ruby
moeabdol has joined #ruby
tubuliferous has joined #ruby
moeabdol has quit [Client Quit]
CausaMortis has quit [Ping timeout: 276 seconds]
moeabdol has joined #ruby
_aeris_ has left #ruby ["Konversation terminated!"]
stannard has joined #ruby
stannard has quit [Remote host closed the connection]
stannard has joined #ruby
terminalrecluse has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rbennace_ has joined #ruby
rbennacer has quit [Ping timeout: 246 seconds]
shibly has joined #ruby
shibly has left #ruby [#ruby]
yos7ph has joined #ruby
PaulCapestany has joined #ruby
chouhoulis has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
PaulCape_ has quit [Ping timeout: 250 seconds]
Devalo has quit [Remote host closed the connection]
sharkman has joined #ruby
<sharkman>
when i scrape with nokogiri, what port does the computer use to load the web pages
SCHAAP137 has quit [Ping timeout: 276 seconds]
<apeiros>
sharkman: nokogiri doesn't do http
Elvin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<sharkman>
oh yeah i was guessing thats why google wont give me any hits when i search "nokogiri port"
benlieb has quit [Quit: benlieb]
thang has joined #ruby
Didac has quit [Ping timeout: 250 seconds]
FooMunki has quit [Ping timeout: 250 seconds]
davedev24 has joined #ruby
SCHAAP137 has joined #ruby
PaulCape_ has joined #ruby
PaulCapestany has quit [Ping timeout: 240 seconds]
idefine has joined #ruby
idefine has quit [Remote host closed the connection]
Didac has joined #ruby
cthulh has joined #ruby
skweek has joined #ruby
saneax_AFK is now known as saneax
<KrzaQ>
What is the correct way to add ruby gem /bin to my path? I used to use export PATH=$PATH:~/.gem/ruby/`ruby -e 'puts RUBY_VERSION'`/bin but after the last update RUBY_VERSION is 2.3.1, yet gems are in the 2.3.0 folder
d0lph1n98 has quit [Ping timeout: 276 seconds]
<shevy>
KrzaQ what is the absolute path? it may be the correct directory path for backwards compatibility for the 2.3.x family of ruby version
kareeoleez has quit [Remote host closed the connection]
<KrzaQ>
/home/krzaq/.gem/ruby/2.3.0/bin
<KrzaQ>
it probably is, shevy, but I want to be able to type pry to get my repl
madgen has quit [Ping timeout: 250 seconds]
ebbflowgo has joined #ruby
chipotle has joined #ruby
kareeoleez has joined #ruby
tubuliferous has quit [Ping timeout: 276 seconds]
<KrzaQ>
I hoped that there was some canonical way to get this
djbkd has joined #ruby
<KrzaQ>
gem environment gempath returns /home/krzaq/.gem/ruby/2.3.0:/usr/lib/ruby/gems/2.3.0, but it's missing /bin on those
terminalrecluse has joined #ruby
<shevy>
yeah... "gem environment gempath" returns /Programs/Ruby/2.3.1/lib/ruby/gems/2.3.0 for me here; I am using ruby 2.3.1
CausaMortis has joined #ruby
madgen has joined #ruby
FooMunki has joined #ruby
<KrzaQ>
soo, the best I came with was ruby -e 'puts RUBY_VERSION.gsub(/\d+$/, "0")'
macscam1 has joined #ruby
macscam1 has quit [Client Quit]
maxscam1 has joined #ruby
<maxscam1>
is there a way to run benchmark without it printing the output? I just want to save it to a variable
diegoaguilar has quit [Remote host closed the connection]
jottr has joined #ruby
Guest64383 has quit [Quit: Leaving]
JesseH2 has joined #ruby
awer has quit [Ping timeout: 276 seconds]
FooMunki has quit [Quit: FooMunki]
kareeoleez has quit [Remote host closed the connection]
awer has joined #ruby
GodFather has quit [Ping timeout: 276 seconds]
augustomna2010 has joined #ruby
skweek has quit [Ping timeout: 260 seconds]
ta_ has joined #ruby
Cohedrin has joined #ruby
Cohedrin_ has quit [Ping timeout: 260 seconds]
auxbuss has quit [Quit: I'm gone.]
bronson has joined #ruby
Azure has quit [Remote host closed the connection]
bluOxigen has joined #ruby
ta_ has quit [Remote host closed the connection]
ferr has joined #ruby
statelesscode has joined #ruby
Xeago has quit [Remote host closed the connection]
PaulCape_ has joined #ruby
agit0 has joined #ruby
bronson has quit [Ping timeout: 252 seconds]
kareeoleez has joined #ruby
LoneHerm_ has joined #ruby
LoneHerm_ has quit [Remote host closed the connection]
LoneHermit has joined #ruby
PaulCapestany has quit [Ping timeout: 244 seconds]
tubuliferous has quit [Ping timeout: 252 seconds]
Xeago has joined #ruby
Xeago has quit [Remote host closed the connection]
tubuliferous has joined #ruby
dan has joined #ruby
Xeago has joined #ruby
kareeoleez has quit [Ping timeout: 252 seconds]
skade has joined #ruby
ramfjord has quit [Ping timeout: 252 seconds]
lxsameer has quit [Ping timeout: 244 seconds]
dan has quit [Client Quit]
silentpost has joined #ruby
zacts has quit [Quit: leaving]
berserk_ren has joined #ruby
zacts has joined #ruby
devbug has joined #ruby
nhhc has quit [Quit: Leaving]
terminalrecluse has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
terminalrecluse has joined #ruby
terminalrecluse has quit [Client Quit]
Xeago has quit [Ping timeout: 276 seconds]
phoo1234567 has joined #ruby
tildes has quit [Ping timeout: 246 seconds]
Ebok has quit [Ping timeout: 260 seconds]
tubuliferous has quit [Ping timeout: 244 seconds]
PedramT has joined #ruby
Devalo has joined #ruby
`tim` has joined #ruby
Devalo has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
PaulCapestany has joined #ruby
PaulCape_ has quit [Ping timeout: 276 seconds]
moeabdol has quit [Ping timeout: 260 seconds]
random has quit [Quit: Page closed]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
futilegames has joined #ruby
elifoster has joined #ruby
ebbflowgo has joined #ruby
statelesscode has quit [Ping timeout: 260 seconds]
ramfjord has joined #ruby
Ebok has joined #ruby
kareeoleez has joined #ruby
LoneHermit has quit [Remote host closed the connection]
madgen has quit [Ping timeout: 276 seconds]
kareeoleez has quit [Remote host closed the connection]
rumia has quit [Quit: Leaving]
stannard has quit [Remote host closed the connection]
emilford has quit [Ping timeout: 252 seconds]
akem has quit [Read error: Connection reset by peer]
augustomna2010 has quit [Ping timeout: 260 seconds]
yqt has joined #ruby
<Gasher>
have any of you used rubocop?
<shevy>
yeah
<shevy>
it's autocorrect option is cool
ruby-lang691 has joined #ruby
<Gasher>
I just discovered it
<Gasher>
and I'm just like WTF
<ruby-lang691>
Hi
<Gasher>
it tells me to use single quotes if I'm not using interpolation at the moment, wuut
PaulCape_ has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
<Gasher>
and doesn't "let" me concatenate strings with +
kareeoleez has joined #ruby
<Ox0dea>
Gasher: Why are you using it?
Spami has quit [Quit: This computer has gone to sleep]
RegulationD has joined #ruby
<Gasher>
what Ox0dea ?
<Ox0dea>
...
madgen has joined #ruby
mustmodify has joined #ruby
PaulCapestany has quit [Ping timeout: 252 seconds]
<Gasher>
Ox0dea; why I'm using rubocop, why I'm using double quotes, why I'm using + to concatenate
<Gasher>
lots of options m8
<Ox0dea>
Guess.
mustmodify has left #ruby [#ruby]
agit0 has quit [Quit: zzzZZZ….]
<Gasher>
I'm guessing I won't answer your question then
statelesscode has joined #ruby
Moosashi has joined #ruby
djbkd has quit []
<havenwood>
Gasher: Do as instructed. Follow the orders of your robotic overlords.
ruby-lang691 has quit [Ping timeout: 250 seconds]
<Gasher>
havenwood; alright, it looks like Skynet is rising :D
<havenwood>
Gasher: When you use single quotes without interpolation it makes it clear that that String doesn't have interpolation. It's for the reader.
hosttor has joined #ruby
<havenwood>
Gasher: Using `+` to concatenate creates multiple Strings.
last_staff has quit [Ping timeout: 252 seconds]
yfeldblum has joined #ruby
RegulationD has quit [Ping timeout: 260 seconds]
<havenwood>
Gasher: TIMTOWTDI though and you can tweak the rubocop settings to your liking if you care to.
<Gasher>
havenwood; I have a string with some instructions to an external program, I'm using interpolation or not depending on the use case
<Gasher>
yes + does, but it looks way cleaner
ta_ has joined #ruby
emilford has joined #ruby
rbennacer has quit [Remote host closed the connection]
roshanavand has quit [Quit: This computer has gone to sleep]
robbyoconnor has joined #ruby
rbennacer has joined #ruby
ta_ has quit [Ping timeout: 260 seconds]
crystal77 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Gasher>
is there a better way to write "if ARGV.length != 3 && ARGV.length != 4"?
shinnya has quit [Ping timeout: 246 seconds]
iaglium has joined #ruby
davedev24 has quit []
<Ox0dea>
You should probably be using `case`.
bluOxigen_ has joined #ruby
<Gasher>
nope, it's only one if
<Gasher>
I just want to check if ARGV is either 3 or 4
bluOxigen_ has quit [Client Quit]
ensyde has quit [Ping timeout: 276 seconds]
<Gasher>
I'm being primitive with them, but that's ok
LoneHermit has joined #ruby
<Ox0dea>
You could say `unless [3, 4].include? ARGV.length`.
rbennacer has quit [Ping timeout: 244 seconds]
JeremyRedhead has joined #ruby
<Gasher>
good one, thanks
<Ox0dea>
It's not "better", just shorter.
bluOxigen has quit [Ping timeout: 250 seconds]
<Gasher>
in the world of programming, shorter is usually better
<Ox0dea>
lel
emilford has quit [Ping timeout: 250 seconds]
futilegames has quit [Quit: futilegames]
<Gasher>
which is different than with other aspects of life :p
berserk_ren has quit [Ping timeout: 276 seconds]
JeremyRedhead has quit [Client Quit]
<adaedra>
nice one.
<adaedra>
but no, shorter and better don't really have a bond in programming
<adaedra>
except that they both match /ter\b/, but that's irrelevant.
futilegames has joined #ruby
tubuliferous has joined #ruby
<smathy>
(3..4) === ARGV.length
tristanp_ has quit []
<adaedra>
using === is usually frowned upon I think.
<Ox0dea>
Which is a shame.
* smathy
is usually frowned upon too
<adaedra>
meh.
tristanp has joined #ruby
<adaedra>
there's more readable equivalents.
<smathy>
I feel free to use all features of a language without concern for frowning ;)
zacstewart has joined #ruby
PaulCapestany has joined #ruby
PaulCape_ has quit [Ping timeout: 244 seconds]
tubuliferous has quit [Ping timeout: 276 seconds]
karapetyan has joined #ruby
Gasher has quit [Quit: Leaving]
<nofxx>
well, this ain't OT on any language... almost like regex. Tip if you need ssl on any project: cacert.org , very nice, now it's green on ffox and chrome too =D
emilford has joined #ruby
Devalo has joined #ruby
karapetyan has quit [Ping timeout: 246 seconds]
futilegames has quit [Quit: futilegames]
sauvin has quit [Read error: Connection reset by peer]
moeabdol has joined #ruby
skweek has joined #ruby
Devalo has quit [Ping timeout: 250 seconds]
n008f4g_ has quit [Ping timeout: 240 seconds]
kareeoleez has quit [Remote host closed the connection]
bluOxigen has joined #ruby
robbyoconnor has quit [Read error: Connection reset by peer]
kareeoleez has joined #ruby
robbyoconnor has joined #ruby
moeabdol has quit [Ping timeout: 276 seconds]
kareeoleez has quit [Ping timeout: 246 seconds]
xlegoman has joined #ruby
PedramT has quit [Remote host closed the connection]
cthulh has quit [Read error: Connection reset by peer]
workmad3 has joined #ruby
rbennacer has quit [Ping timeout: 260 seconds]
roshanavand has joined #ruby
Trynemjoel has quit [Ping timeout: 244 seconds]
benlieb has joined #ruby
agent_white has joined #ruby
<agent_white>
Afternoon
karapetyan has joined #ruby
rbennacer has joined #ruby
roshanavand has quit [Read error: Connection reset by peer]
pontiki has quit [Quit: "Poets have been mysteriously silent on the subject of cheese." -- G.K.Chesterson]
ta__ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
emilford has quit [Ping timeout: 276 seconds]
isxek has quit [Quit: Leaving]
kareeoleez has joined #ruby
Trynemjoel has joined #ruby
karapetyan has quit [Ping timeout: 246 seconds]
roshanavand has joined #ruby
<nofxx>
django is free now
workmad3 has quit [Ping timeout: 252 seconds]
Xeago has joined #ruby
Ebok has joined #ruby
hakunin_ has quit [Read error: Connection reset by peer]
Trynemjoel has quit [Ping timeout: 244 seconds]
hakunin has joined #ruby
Trynemjoel has joined #ruby
devbug has joined #ruby
gregf has quit [Quit: WeeChat 1.4]
saneax_AFK is now known as saneax
jottr_ has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
gregf has joined #ruby
Xeago has quit [Ping timeout: 276 seconds]
jottr has quit [Ping timeout: 260 seconds]
Trynemjoel has quit [Ping timeout: 264 seconds]
croberts has joined #ruby
rbennacer has quit [Ping timeout: 276 seconds]
diegoviola has quit [Quit: WeeChat 1.4]
flashpoint9 has quit [Remote host closed the connection]
Dimik has quit [Ping timeout: 250 seconds]
solocshaw1 has joined #ruby
solocshaw has quit [Ping timeout: 276 seconds]
solocshaw1 is now known as solocshaw
wuyin has quit [Ping timeout: 260 seconds]
last_staff has joined #ruby
roshanavand has quit [Read error: Connection reset by peer]
alexherbo2 has quit [Quit: WeeChat 1.4]
`tim` has joined #ruby
rbennacer has joined #ruby
mlakewood has quit [Quit: mlakewood]
Trynemjoel has joined #ruby
jottr_ has quit [Ping timeout: 244 seconds]
roshanavand has joined #ruby
emilford has joined #ruby
sp4rrow has quit [Ping timeout: 240 seconds]
DarkBushido has quit [Ping timeout: 246 seconds]
sp4rrow has joined #ruby
Trynemjoel has quit [Ping timeout: 264 seconds]
bronson has joined #ruby
rbennacer has quit [Ping timeout: 260 seconds]
framling has joined #ruby
Moosashi has joined #ruby
tubuliferous has joined #ruby
AnoHito has joined #ruby
bronson has quit [Ping timeout: 252 seconds]
Trynemjoel has joined #ruby
AnoHito_ has quit [Ping timeout: 240 seconds]
Asher has quit [Quit: Leaving.]
tubuliferous has quit [Ping timeout: 276 seconds]
ta__ has quit [Read error: Connection reset by peer]
ta_ has joined #ruby
Trynemjoel has quit [Ping timeout: 264 seconds]
Asher has joined #ruby
flashpoint9 has joined #ruby
cpup has quit [Ping timeout: 276 seconds]
Moosashi has quit [Quit: Moosashi]
cpup has joined #ruby
crystal77 has quit [Read error: Connection reset by peer]
crystal7_ has joined #ruby
mlakewood has joined #ruby
Jackneill has quit [Ping timeout: 260 seconds]
flashpoint9 has quit [Remote host closed the connection]
n008f4g_ has quit [Ping timeout: 276 seconds]
zenlot has joined #ruby
crystal77 has joined #ruby
zenlot6 has quit [Ping timeout: 276 seconds]
crystal7_ has quit [Ping timeout: 244 seconds]
hagarelvikingo has quit [Ping timeout: 246 seconds]
n008f4g_ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
ta_ has joined #ruby
kareeoleez has quit [Remote host closed the connection]
crystal77 has quit [Read error: Connection reset by peer]
Eiam_ has joined #ruby
crystal77 has joined #ruby
statelesscode has joined #ruby
hagarelvikingo has joined #ruby
ismaelga has quit [Remote host closed the connection]
ismaelga has joined #ruby
crystal7_ has joined #ruby
JeremyRedhead has joined #ruby
<JeremyRedhead>
Hello
<Radar>
good morning
firstdayonthejob has quit [Ping timeout: 260 seconds]
crystal77 has quit [Read error: Connection reset by peer]
<JeremyRedhead>
So, I hate to be asking what's probably a very dumb question, but I can't seem to find any information on it...
<JeremyRedhead>
Why does .to_i! (or .to_f!, .to_sym!, etc...) not work?
TomyLobo has quit [Ping timeout: 252 seconds]
<Radar>
On what object?
<Radar>
and where did you see these to_i! to_f! and to_sym! methods?
Ebok has quit [Quit: This computer has gone to sleep]
<JeremyRedhead>
What I mean is if I want to 'permanently' change some var, why can't I use var.to_i! instead of var=var.to_i ?
diegoaguilar has joined #ruby
GodFather has quit [Ping timeout: 252 seconds]
diegoaguilar has quit [Read error: Connection reset by peer]
<Radar>
That kind of mutation can have unintended side-effects and so it is not encouraged.
<apeiros>
it's not possible
<apeiros>
ruby is strongly typed, that means an object can't change its type
diegoaguilar has joined #ruby
<apeiros>
remember, methods are about the objects, not about variables.
<arahael>
JeremyRedhead: also, the exclaimation mark is a mere... convention.
<arahael>
JeremyRedhead: those methods don't work because they don't exist nor have they been written. apeiros explains how they could not be written.
elifoster has quit [Ping timeout: 240 seconds]
<arahael>
JeremyRedhead: though... you could define a 'to_i!' method yourself if you wanted to. but you won't be able to mutate the type itself so the method name will be confusing... to say the least.
elifoster has joined #ruby
phoo1234567 has quit [Quit: Gotta go]
sp4rrow_ has joined #ruby
hagarelvikingo has quit [Ping timeout: 260 seconds]
<JeremyRedhead>
...so what exactly actually happens when I type var=var.to_i ?
sp4rrow has quit [Ping timeout: 260 seconds]
<apeiros>
`var.to_i` -> 1 "get the object referenced by var", 2 "send the message `to_i` to it"
blaxter has quit [Quit: KTHXBYE]
<arahael>
JeremyRedhead: you invoke the method "to_i", on the object indicated by 'var', causing it's implementation to run, returnig a result. you then re-assign this to 'var'
<apeiros>
`var = …` -> 3 "assign the return value of the to_i message to var"
RegulationD has joined #ruby
<apeiros>
what to_i itself does depends entirely on the object referenced by var. but usually it'll return an Integer representation of the object
FooMunki has joined #ruby
LoneHerm_ has joined #ruby
roshanavand has quit [Quit: This computer has gone to sleep]
dudepare has joined #ruby
RegulationD has quit [Ping timeout: 252 seconds]
SCHAAP137 has quit [Quit: Leaving]
roshanavand has joined #ruby
dudepare has quit [Client Quit]
dudepare has joined #ruby
pawnbox has joined #ruby
ruid has joined #ruby
davedev24 has joined #ruby
biberu has quit []
Eiam_ has quit [Quit: ╯°□°)╯︵ǝpouǝǝɹɟ]
pawnbox has quit [Ping timeout: 276 seconds]
Ebok has joined #ruby
JeremyRedhead has quit [Ping timeout: 250 seconds]
zacstewart has joined #ruby
fedexo has quit [Ping timeout: 276 seconds]
emilford has quit [Ping timeout: 260 seconds]
sepp2k1 has quit [Read error: Connection reset by peer]
last_staff has quit [Quit: last_staff]
GodFather has joined #ruby
zacstewart has quit [Ping timeout: 276 seconds]
dramagods has quit [Remote host closed the connection]
moeabdol has joined #ruby
davedev24 has quit [Ping timeout: 250 seconds]
LoneHerm_ has quit [Remote host closed the connection]