nertzy has quit [Quit: This computer has gone to sleep]
marxarelli is now known as marxarelli|afk
rikai has quit [Ping timeout: 246 seconds]
duderono_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rikai has joined #ruby
charliesome has joined #ruby
gusrub has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 246 seconds]
<stormbytes>
what does this phrase 'say' in Ruby terms: Application::Console.prompt.display
enterprisey has joined #ruby
<stormbytes>
is Application a class with Console as a method or module?
<elomatreb>
Application is a module, Console is (probably) a class, and prompt and display are methods
davidmichaelkarr has quit [Quit: Connection closed for inactivity]
<stormbytes>
chained methods?
<elomatreb>
Yes
<elomatreb>
(Application::Console.prompt).display
<stormbytes>
meaning... <execute>display and pass the output onto prompt
<elomatreb>
No, it calls prompt on Console, and then .display on the return value of that
oliv_____ has joined #ruby
mitt3ns has joined #ruby
<stormbytes>
Oh, i see.. ok. so, simplifying it a bit, assuming I'm not using a module... I would define a class called Console and some methods, and then I could just call them with Console::method without instantiating the class?
<ineb>
like Human::Male.mouth.speak :)
<stormbytes>
lol ineb well put
<bougyman>
=> :lies
<elomatreb>
If you need to call the methods without instantiation you need to define them as such
<stormbytes>
how is it you don't need to George = new Male
<elomatreb>
`def method` vs. `def self.method`, where the latter is callable on the Class (that is without instantiation)
<stormbytes>
elomatreb how do you do that?
<bougyman>
ideally (imo), self.thing is just an alternate way to instantiate the class.
<havenwood>
stormbytes: "Application is a #{Application.class} and Application::Console is a #{Application::Console.class} with a #{Application::Console.class.downcase} method ::prompt which returns a #{Application::Console.prompt.class}."
<stormbytes>
havenwood wow.. that's a mouthful :)
<bougyman>
for "helper" type methods I'd use a Module.method
<havenwood>
stormbytes: Run it!
<stormbytes>
run what?
Guest73587 has quit [Excess Flood]
agent_white has quit [Remote host closed the connection]
forgot has joined #ruby
<stormbytes>
oh.. that?
<havenwood>
stormbytes: That ^ string
jcao219 has quit [Ping timeout: 246 seconds]
<stormbytes>
in... that eva thing?
<stormbytes>
eval
<havenwood>
irb or pry
<havenwood>
?pry
<ruby[bot]>
Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<stormbytes>
lets say i have a string and I want to test it for certain substrings and perform an action if one is found, would that be best served with case/when or if/elsif?
<havenwood>
it depends
trampy has joined #ruby
<stormbytes>
havenwood that's nuts.. so first one goes to the first var, then last elem to the last variabe, and everything else gets dumped into *body
mim1k has quit [Ping timeout: 246 seconds]
jcao219 has quit [Ping timeout: 260 seconds]
rkazak_ has quit [Quit: Sleep.....ing....]
enterprisey has quit [Remote host closed the connection]
KnownSyntax has joined #ruby
dc2 has joined #ruby
gizmore|2 has joined #ruby
gizmore has quit [Ping timeout: 246 seconds]
mim1k has joined #ruby
im0nde has quit [Ping timeout: 268 seconds]
mim1k has quit [Ping timeout: 255 seconds]
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
czeq has joined #ruby
trampy has quit [Ping timeout: 260 seconds]
ascarter has joined #ruby
duderonomy has joined #ruby
GodFather has quit [Ping timeout: 260 seconds]
mrconfused has joined #ruby
mim1k has joined #ruby
mim1k has quit [Ping timeout: 260 seconds]
frem has joined #ruby
genpaku has quit [Remote host closed the connection]
uZiel has quit [Ping timeout: 248 seconds]
genpaku has joined #ruby
bkxd has joined #ruby
czeq has quit [Ping timeout: 260 seconds]
A124 has quit [Ping timeout: 255 seconds]
knight33 has joined #ruby
bkxd has quit [Ping timeout: 246 seconds]
A124 has joined #ruby
cschneid_ has joined #ruby
mim1k has joined #ruby
cschneid_ has quit [Ping timeout: 255 seconds]
sleetdrop has joined #ruby
jcao219 has joined #ruby
mim1k has quit [Ping timeout: 259 seconds]
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
HoierM has quit [Ping timeout: 246 seconds]
dc2 has quit [Ping timeout: 260 seconds]
jgt3 has joined #ruby
jgt3 has quit [Ping timeout: 258 seconds]
mim1k has joined #ruby
latemus has quit [Ping timeout: 240 seconds]
Ferdroid has quit [Ping timeout: 268 seconds]
Ferdroid has joined #ruby
mim1k has quit [Ping timeout: 246 seconds]
gusrub has joined #ruby
jackjackdripper has joined #ruby
Ferdroid has quit [Ping timeout: 240 seconds]
jackjackdripper has quit [Client Quit]
jackjackdripper has joined #ruby
gusrub has quit [Ping timeout: 246 seconds]
Ferdroid has joined #ruby
hashrocket has quit [Quit: Connection closed for inactivity]
gix has quit [Ping timeout: 255 seconds]
AnoHito_ has joined #ruby
gix has joined #ruby
AnoHito has quit [Ping timeout: 268 seconds]
cfec0b8d has joined #ruby
mitt3ns is now known as agent_white
jenrzzz has joined #ruby
jgnagy has joined #ruby
jgnagy has quit [Ping timeout: 246 seconds]
uZiel has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
Immune has joined #ruby
arescorpio has joined #ruby
perniciouscaffei has joined #ruby
uZiel has quit [Ping timeout: 248 seconds]
dasher00 has quit [Ping timeout: 246 seconds]
<stormbytes>
is this illegal elsif input.include?("calories" || "calorie")?
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<lostapathy>
"legal", yes. What you want, doubtful
<stormbytes>
figured
<stormbytes>
i can use a regex to append the optional 's'
mim1k has joined #ruby
<lostapathy>
think about it from the inside of parenthesis out, like havenwood did
dasher00 has joined #ruby
<lostapathy>
input.include?("calorie") probably does what you want in that case, since you aren't matching on anything else afterward - it allows the s or anything else
<stormbytes>
so that becomes an if (foo) || do something else
<stormbytes>
lostapathy good point
<stormbytes>
didn't see that
mim1k has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #ruby
nowhere_man has quit [Remote host closed the connection]
patarr has joined #ruby
nowhere_man has joined #ruby
Cohedrin has quit [Read error: Connection reset by peer]
Cohedrin has joined #ruby
renchan has joined #ruby
patarr has quit [Ping timeout: 268 seconds]
knight33 has joined #ruby
nofxxx has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jcao219 has quit [Ping timeout: 255 seconds]
AnoHito has joined #ruby
enterprisey has joined #ruby
nofxxxx has quit [Ping timeout: 246 seconds]
ascarter has joined #ruby
AnoHito_ has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
ascarter has quit [Ping timeout: 255 seconds]
ascarter has joined #ruby
AnoHito_ has joined #ruby
AnoHito has quit [Ping timeout: 240 seconds]
AnoHito has joined #ruby
ascarter_ has joined #ruby
jcao219 has joined #ruby
AnoHito_ has quit [Ping timeout: 245 seconds]
Bock has joined #ruby
skixlix has joined #ruby
<skixlix>
Why is it that with the lcm method you would have 9.lcm(3) where 9 is the receiver and 3 is the argument, but for a self defined thing, like
<skixlix>
def add_two_numbers(x, y)
<skixlix>
x + y
<skixlix>
end
<skixlix>
you would have to use it without a receiver, and just use two arguments?
<skixlix>
add_two_numbers(5, 2) would output 7, but why not have it be
<skixlix>
5.add_two_numbers(2)
<skixlix>
I don't see any reason the 9 needs to be in front for the lcm, 3 and 9 are just two things needed right, nothing special about the 9
jenrzzz has joined #ruby
<arahael>
skixlix: Because it doesn't scale. Why should "add_two_numbers" be a property of integers?
<arahael>
skixlix: But sure, if you have a 10-line script, do it that way.
<arahael>
skixlix: But where I am, I count lines of code in the millions.
ascarter has quit [Ping timeout: 240 seconds]
<skixlix>
hmm
<skixlix>
what do you mean "be a property of integers?"
<skixlix>
both use integers, rite? the lcm and the adding numbers one
<skixlix>
what is the point of the receiver vs the argument?
<arahael>
skixlix: Ruby has single-dispatch.
<skixlix>
the 9 in 9.lcm(3) is the receiver and the 3 is the argument, correct?
<arahael>
skixlix: It determines which method you want to use by way of single dispatch - the reciever dictates which method is called.
<skixlix>
oh interesting
<skixlix>
I'm gonna read more about that
<arahael>
skixlix: Generally speaking, most object oriented systems are single dispatch - only a very few support multiple dispatch.
<arahael>
skixlix: So what you learn there is likely to be general.
<skixlix>
so the receiver is just the 9, or the 9.lcm as a group
<skixlix>
the lcm is the part that ensures the program knows which method I'm trying to use right
mitt3ns has joined #ruby
<arahael>
skixlix: The receiver there is the 9. lcm is the name of the message you are sending to it, with the arguments.
Cohedrin has quit [Read error: Connection reset by peer]
<skixlix>
ahh Isee
<skixlix>
why is it they couldn't have done it
<skixlix>
lcm(9, 3)
cschneid_ has joined #ruby
<arahael>
skixlix: They could have done it that way. But I guess the writer decided that all integeres should support that.
jgt3 has joined #ruby
axsuul has joined #ruby
<arahael>
skixlix: Though personally, I'd like to put it into some sort of math library, but the advantage of putting it into the integer class means that you can have a sorta-infix style of writing.
<arahael>
And most people are more comfortable with infix style when doing maths.
<dminuoso>
arahael: I would not call this infix style no matter how many beer I had.
<skixlix>
wow ok thank you very much
<skixlix>
I'm very new to ruby, sorry I sound like such a noob
<skixlix>
thanks for the help though, you've given me some to read up on too :)
<arahael>
dminuoso: Yeah. Even "sorta infix" style is pushing it. :(
Cohedrin has joined #ruby
<skixlix>
I'm not sure what infix and prefix are referring to when talking about coding, I'm googling lol
ascarter_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
skixlix: prefix: + 1 2
<dminuoso>
postfix 1 2 +
<arahael>
skixlix: It's not infix, however I was hoping to suggest that the way it's written is different. Google RPN notation, vs infix.
<dminuoso>
infix 1 + 2
<dminuoso>
function style: add(1, 2)
<skixlix>
oh
<dminuoso>
method style: 1.add(2)
cschneid_ has quit [Ping timeout: 246 seconds]
<dminuoso>
or the more ruby-like variant
<skixlix>
oh it has to do with the location of the operator
<arahael>
skixlix: l-expr style: (+ 1 2)
<arahael>
skixlix: m-expr style: +(1 2)
<dminuoso>
1.+(2)
jgt3 has quit [Ping timeout: 246 seconds]
<dminuoso>
skixlix: Yeah. It's basically a parsing thing.
boombox_ has joined #ruby
<arahael>
skixlix: Haskell infix style: 1 `add` 2
<dminuoso>
skixlix: and some notations, like the Polish notation for mathematics, dont use infix.
<skixlix>
so
<skixlix>
3.times do
hutch34 has joined #ruby
<arahael>
skixlix: But in this particular case with ruby, it also becomes a code organisation thing.
<skixlix>
does that have an infix postfix
<skixlix>
type thing
jackjackdripper has quit [Quit: Leaving.]
<dminuoso>
skixlix: no
<skixlix>
or no because there's only a 3
<dminuoso>
skixlix: it's method-style
<skixlix>
ah
<skixlix>
so in ruby it can change
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<skixlix>
like I could define something as infix or otherwise
rohitpaulk has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #ruby
<dminuoso>
skixlix: no
<dminuoso>
skixlix: infix operators are hardwired into the parser
<dminuoso>
skixlix: but they are overloadable
<skixlix>
oh ok
<arahael>
skixlix: In other languages, any standalone function can be used infix style, but not in ruby.
<arahael>
skixlix: (Eg, the backticks for the haskell version I gave)
<dminuoso>
skixlix: And by overloadable I mean: you can take any class, define the method :+ on it, and then you can take two objects like car1 and car2 and do: result = car1 + car2
<skixlix>
ah right
<arahael>
Note, there, that in ruby, even that uses single-dispatch to resolve the operator.
oleo has quit [Quit: irc client terminated!]
<dminuoso>
Or in some cases not even that. :-)
<skixlix>
hmm ok ty
<dminuoso>
arahael: Are you new around here? I distinctly remember seeing your name in the C++ channels
<dminuoso>
And by here I mean #ruby
<skixlix>
I'll brb thanks tho guys :D
hutch34 has quit [Ping timeout: 240 seconds]
boombox_ has quit [Remote host closed the connection]
aupadhye has joined #ruby
aupadhye has quit [Ping timeout: 268 seconds]
arescorpio has quit [Quit: Leaving.]
ascarter has joined #ruby
jenrzzz has quit [Ping timeout: 258 seconds]
skixlix is now known as skixlixxx
nimboo has joined #ruby
skixlixxx is now known as skixlix
harfangk has joined #ruby
<nimboo>
hi
nalread has joined #ruby
nimboo has quit [Client Quit]
nimboo has joined #ruby
aupadhye has joined #ruby
skixlix is now known as skixlixx
skixlixx is now known as skixlix
nimboo has quit [Client Quit]
__Yiota has joined #ruby
uZiel has joined #ruby
__Yiota has quit [Ping timeout: 246 seconds]
szu has joined #ruby
aufi has joined #ruby
morfin has joined #ruby
<arahael>
dminuoso: I come and go, but I suppose I am still relatively new to #ruby.
<morfin>
returning to Random - seems like there is only uniform distribution
<dminuoso>
morfin: What do you mean?
<morfin>
did you see how many distributions has <random> in C++?
<dminuoso>
Random is just your standard MT19337 PRNG
<dminuoso>
Yes.
segmond has quit [Quit: l8r]
<morfin>
uniform, discrete, gamma, bernoulli etc
<dminuoso>
Oh well.
<dminuoso>
morfin: Ruby is rarely used in scientific scenarios. It's kind of a devils circle I guess.
<morfin>
:)
<dminuoso>
morfin: Be glad that the OpenSSL support is plugged in so well. :-)
<arahael>
morfin: I often see scientific circles using python.
<dminuoso>
^-
skixlix has quit []
<arahael>
Though, Julia seems to be growing.
<dminuoso>
Which again is yet another devils circle.
<morfin>
hmm
<morfin>
why so?
<morfin>
poor perfomance for their purposes?
zenguy_pc has quit [Ping timeout: 255 seconds]
jcao219 has quit [Ping timeout: 260 seconds]
<arahael>
morfin: On the contrary, it has pretty good performance. Together with tools such as ipython (know known as Jupyter), it's pretty good. The problem is that the toolchain is a bit of a mess.
<dminuoso>
Jupyter? Really?
<dminuoso>
That is such terrible naming..
pwnd_nsfw` has joined #ruby
<morfin>
i think GCC is real mess: )
<dminuoso>
morfin: GCC is old.
<morfin>
i know
<arahael>
GCC is very old.
<dminuoso>
morfin: Most GNU projects are a mess because they have evolved from 20-30 years of development.
enterprisey has quit [Remote host closed the connection]
<morfin>
and Python is not such mess
<dminuoso>
Just look at autotools
<dminuoso>
Its gross.
<morfin>
eew
<dminuoso>
GCC is completely harmless
<morfin>
autotools is thing i avoid
<morfin>
and m4
pwnd_nsfw has quit [Ping timeout: 260 seconds]
<arahael>
dminuoso: It's a better name than "ipython". ;)
<morfin>
well, most cases require uniform distribution
ur5us has quit [Remote host closed the connection]
zenguy_pc has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
rohitpaulk has quit [Ping timeout: 255 seconds]
<arahael>
morfin: I'd be careful claiming that.
<arahael>
morfin: The nature of the distribution tends to be quite significant. Gaming, vs encryption scenarios, for instance.
<arahael>
When I am doing tests, I even like _predicably-random_ distributions.
<matthewd>
morfin: I think SciRuby might cover that domain
Cohedrin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ruby[bot]>
dminuoso: I'm terribly sorry, I could not evaluate your code because of an error: OpenURI::HTTPError:500 Internal Server Error
* dminuoso
sighs
<ljarvis>
your code is wrong anyway
<dminuoso>
Oh.
<ljarvis>
but yes, you pedant
<dminuoso>
I was hoping to win a cookie
<dminuoso>
and failed miserably at nitpicking.
<ljarvis>
yep, no cookie for you
<dminuoso>
:(
gusrub has joined #ruby
Cohedrin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has joined #ruby
dennisvennink has joined #ruby
vali has quit [Remote host closed the connection]
gusrub has quit [Ping timeout: 240 seconds]
vali has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
PatrikasZvaigzde has quit [Ping timeout: 246 seconds]
Antiarc has quit [Ping timeout: 260 seconds]
mim1k has quit [Ping timeout: 246 seconds]
nanoz has joined #ruby
nanoz has joined #ruby
nanoz has quit [Changing host]
xall has quit [Ping timeout: 245 seconds]
mim1k has joined #ruby
PatrikasZvaigzde has joined #ruby
zenguy_pc has quit [Ping timeout: 246 seconds]
bvcosta has joined #ruby
<workmad3>
oh, random distributions? fun :)
fxa90id has joined #ruby
fxa90id has joined #ruby
fxa90id has quit [Changing host]
zenguy_pc has joined #ruby
cjhowe7 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
HoloIRCUser1 has quit [Ping timeout: 246 seconds]
aufi has joined #ruby
jameser_ has joined #ruby
jameser has quit [Ping timeout: 240 seconds]
nalread has quit [Quit: Leaving]
CrazyEddy has quit [Remote host closed the connection]
jameser has joined #ruby
* dminuoso
hides workmad3's cookies using a random distribution
<dminuoso>
Good luck finding them.
nanoz has quit [Ping timeout: 246 seconds]
<universa1>
pseudo random? ;)
jameser_ has quit [Ping timeout: 255 seconds]
HoloIRCUser2 has joined #ruby
xall has joined #ruby
<herwin>
it's easy to find them: it were tracking cookies
Otti has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
zenguy_pc has quit [Ping timeout: 246 seconds]
Antiarc has joined #ruby
dionysus69 has joined #ruby
navycrosser has joined #ruby
zenguy_pc has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
minimalism has quit [Ping timeout: 255 seconds]
pandaant has joined #ruby
mim1k has quit [Ping timeout: 255 seconds]
jameser has joined #ruby
Pumukel has joined #ruby
mim1k has joined #ruby
Pumukel has quit [Read error: Connection reset by peer]
bvcosta has quit [Remote host closed the connection]
Pumukel has joined #ruby
bvcosta has joined #ruby
Pumukel has quit [Read error: Connection reset by peer]
Pumukel has joined #ruby
ur5us has joined #ruby
mikecmpbll has quit [Read error: Connection reset by peer]
mikecmpbll has joined #ruby
bvcosta has quit [Ping timeout: 246 seconds]
Pumukel has quit [Read error: Connection reset by peer]
Pumukel has joined #ruby
rohitpaulk has quit [Ping timeout: 260 seconds]
lxsameer has joined #ruby
Otti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgr has joined #ruby
<dminuoso>
herwin: In soviet russia cookies track you.
cschneid_ has joined #ruby
<apeiros>
shouldn't that be the other way round?
<apeiros>
since in the normal world, cookies track you, it'd be "In soviet russia, you track cookies"?
<herwin>
Chuck Norris doesn't need breadcrumbs, he has tracking cookies
<workmad3>
I wish I could track cookies... I'm hungry :(
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Pumukel has quit [Ping timeout: 260 seconds]
antgel has joined #ruby
<workmad3>
also, I really need to uphold my culture better and start calling them 'tracking biscuits'
<dminuoso>
apeiros: I turned it around since herwin implied already that a tracking cookie means you could track the cookie, thus making the cookies easy to find,
cschneid_ has quit [Ping timeout: 246 seconds]
<dminuoso>
Though I admit Im kind of pulling a Sheldon there.
<workmad3>
s/Im/I'm/ :P
<workmad3>
(seriously, your pedantism is not kicking in fully today, is it? :) )
<dminuoso>
Oh boy.
<dminuoso>
You are right. I give up today.
<dminuoso>
Opioid painkillers seem to have an impact on my brain.
<apeiros>
can you give it to me? I'm still in need of a today.
<workmad3>
heh :) well, that is kinda what they're meant to do
<dminuoso>
Heh
<apeiros>
oy? what are you on and why?
<workmad3>
given he's able to type, I'm guessing codeine?
navycrosser has quit [Ping timeout: 240 seconds]
Terens has joined #ruby
<Terens>
hello
marr has joined #ruby
vali has quit [Read error: Connection reset by peer]
mikecmpb_ has joined #ruby
mikecmpbll has quit [Ping timeout: 246 seconds]
xychix has quit [Ping timeout: 240 seconds]
tvw has joined #ruby
<apeiros>
hi Terens
<Terens>
I am using event-machine with HTTP. All I want to do is do periodic post requests. Adding periodic_timer how can I ensure that previous request has finisehd?
<workmad3>
Terens: minor difference is that this method will start another request 5s after the last one finished, rather than every 5s
<Terens>
indeed
<canton7>
(might be a good thing: you might not want requests overlapping)
mikecmpb_ has quit [Ping timeout: 246 seconds]
<Terens>
I guess so
zenspider has quit [Read error: Connection reset by peer]
xall has quit [Ping timeout: 255 seconds]
<Terens>
I should find a way to terminate this too
<workmad3>
and if you have a status flag, you avoid overlapping requests, but you may have the next request trigger only a second or so after the last one finished
<dminuoso>
workmad3: Codeine sucks though, I don't feel high. :(
* dminuoso
needs to find another docto
<dminuoso>
doctor.
tomphp has joined #ruby
<workmad3>
dminuoso: yeah, it's the weakest of the opioid painkillers (to the point where you can get it over the counter in the UK when it's combined with paracetamol or ibuprofen)
jameser has quit [Ping timeout: 240 seconds]
<dminuoso>
I wonder, why is there no HTTP version that requires proof-of-work client side?
<dminuoso>
Email has it :A
anisha has quit [Ping timeout: 240 seconds]
sylario has joined #ruby
flying has joined #ruby
anisha has joined #ruby
<apeiros>
dminuoso: I think you have it wrong regarding cause & effect ;-p
xall has joined #ruby
patarr has joined #ruby
PenguinHunterX3X has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
PenguinHunterX3X has left #ruby [#ruby]
xychix has joined #ruby
romank has joined #ruby
rohitpaulk has quit [Ping timeout: 255 seconds]
patarr has quit [Ping timeout: 246 seconds]
jgnagy has joined #ruby
nowhereman has quit [Ping timeout: 240 seconds]
zenspider_ is now known as zenspider
zenspider has quit [Changing host]
zenspider has joined #ruby
belmoussaoui has joined #ruby
ddffg has joined #ruby
zenguy_pc has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #ruby
jgnagy has quit [Ping timeout: 260 seconds]
<Terens>
should I have a single EM.run block at my app ?
sleetdrop has quit [Quit: Computer has gone to sleep.]
<dminuoso>
Indeed. Namespace bindings are a bitch.
<dminuoso>
Just use .css
MarkBilk has joined #ruby
benjen has joined #ruby
Lord_of_Life has left #ruby ["Laa shay'a waqi'un moutlaq bale kouloun moumkine"]
<canton7>
use .remove_namspaces! also does the trick
<dminuoso>
Uh...
agent_white has quit [Quit: bai]
<dminuoso>
If only I had a shotgun to threaten you with.
<canton7>
(not that I'd necessarily recommend it, but that doc doesn't use namespaces at all, other than setting the default xmlns)
<dminuoso>
I'd say just use css
<dminuoso>
the interface is so much more usable
<canton7>
yeah, it's not quite as powerful, but I don't need to go read the xpath docs every time I see one :P
nowhereman has quit [Ping timeout: 246 seconds]
cdg has joined #ruby
<dminuoso>
canton7: In my humble experience it's grossly overpaid Senior Java Enterprice Architects that use lots of fancy XPath expressions where a 10 character regex would have sufficed.
<dminuoso>
Not before constructing a singleton HelperFactoryAdapterPolicyPatternGeneratorFactory though
DTZUZU has quit [Ping timeout: 268 seconds]
brent__ has joined #ruby
rgr has quit [Quit: rgr]
<canton7>
you'd use regex on xml?
<dminuoso>
canton7: Yes.
<dminuoso>
I have some production code that does it even.
<dminuoso>
When you know your input it's quite safe to do this.
rohitpaulk has quit [Ping timeout: 255 seconds]
ldnunes has joined #ruby
marr has quit [Ping timeout: 240 seconds]
<canton7>
yeah, but something like '/items/item[last()]' must be a PITA with regex, never things whitespace, attributes appearing in any order, self-closing vs closed tags, etc
brent__ has quit [Ping timeout: 240 seconds]
aupadhye has joined #ruby
Guest97009 has quit [Ping timeout: 240 seconds]
chouhoulis has joined #ruby
rohitpaulk has joined #ruby
cfec0b8d has quit [Read error: Connection reset by peer]
rgr has joined #ruby
chat_ has joined #ruby
kspencer has quit [Changing host]
kspencer has joined #ruby
rohitpaulk has quit [Ping timeout: 240 seconds]
HoierM has joined #ruby
<dminuoso>
canton7: No it's easy!
oliv_____ has joined #ruby
<dminuoso>
str.reverse =~ /<meti>(.*)<meti\/>/
<dminuoso>
Clearly!
contradictioned has joined #ruby
<dminuoso>
There may or may not be some mistake in that.
VladGh has quit [Remote host closed the connection]
<slima>
canton7: thx!
VladGh has joined #ruby
<dminuoso>
canton7: But as I said, when you know about the input it can be perfectly fine.
<slima>
dminuoso: thx too
<dminuoso>
canton7: In my case I apply regex to machine generated XML from embedded hardware we are operating.
im0nde has joined #ruby
mim1k has quit [Ping timeout: 260 seconds]
oliv_____ has quit [Remote host closed the connection]
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cdg has quit [Remote host closed the connection]
cdg has joined #ruby
davic has joined #ruby
oliv_____ has joined #ruby
nowhereman has joined #ruby
petruff has joined #ruby
oliv_____ has quit [Remote host closed the connection]
mrconfused has quit [Ping timeout: 260 seconds]
chouhoulis has quit [Remote host closed the connection]
MrBismuth has quit [Ping timeout: 246 seconds]
im0nde has quit [Ping timeout: 246 seconds]
stamina has quit [Quit: WeeChat 1.8]
cyphase has quit [Ping timeout: 240 seconds]
synthroid has joined #ruby
synthroi_ has joined #ruby
minimalism has joined #ruby
uZiel has joined #ruby
ur5us has quit [Remote host closed the connection]
gaurav has joined #ruby
ur5us has joined #ruby
oliv_____ has joined #ruby
Mortomes|Work has quit [Ping timeout: 260 seconds]
psychicist__ has joined #ruby
synthroid has quit [Ping timeout: 268 seconds]
<gaurav>
Hi I am trying to append something to the end of a string. Where my string is "Bar" I want to append "0" to the end so it becomes "Bar0"
cfec0b8d has joined #ruby
<gaurav>
'Bar'.gsub('/\Z/', '0')
<gaurav>
is what I am trying.
<gaurav>
$,\$,\$/ also don't seem to work.
<tobiasvl>
gaurav: well, can't you just do 'Bar' + '0' in that simple case? what do you want to do precisely?
uZiel has quit [Ping timeout: 248 seconds]
DTZUZU has joined #ruby
<universa1>
or "Bar" << 0
HoloIRCUser1 has quit [Quit: HoloIRCUser1]
cfec0b8d has quit [Remote host closed the connection]
cyphase has joined #ruby
<gaurav>
'Bar' << 0 gives => "Bar\x00"
ur5us has quit [Ping timeout: 255 seconds]
<tobiasvl>
'Bar' << '0'
<universa1>
and if you pass the regexp as an actual regexp, and not a string, it actually works.
<tobiasvl>
haha, I missed that
<tobiasvl>
>> 'Bar'.gsub(/\Z/, '0')
<ruby[bot]>
tobiasvl: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<tobiasvl>
what the
cdg_ has joined #ruby
cfec0b8d has joined #ruby
<gaurav>
Thanks tobiasvl it seems like I just needed to remove my quotes from my matching regex. :)
<apeiros>
tobiasvl: happens when eval.in returns an error (error in handling non-200 status codes)
DoubleMalt has quit [Ping timeout: 255 seconds]
<apeiros>
and eval.in has been rather uppity the last few weeks
pupsicle has quit [Client Quit]
<apeiros>
gaurav: << "0" is definitively the much better choice than gsub
<apeiros>
gaurav: also pay attention to delimiters/identifying sigils. "0" and 0 are not the same. "/\Z/" and /\Z/ are not the same. etc.
oliv_____ has quit [Ping timeout: 255 seconds]
xall has joined #ruby
oliv_____ has joined #ruby
uZiel has joined #ruby
jameser has joined #ruby
<ineb>
i wrote a little script which counts words from files from a dir: https://paste.xinu.at/5on4/ i made it with threads and was expecting performance gain but no matter what i pick as nr_threads, script runtime is always almost the same. did i made a mistake somewhere?
<dminuoso>
apeiros, so here's just a silly thought but
<dminuoso>
Why doesn't ruby[bot] have an error handler for that?
SaschaVoid has joined #ruby
<Burgestr_>
ineb ruby's parallelism is (mostly) limited to IO operations, which means that your word-counting is only concurrent, which could be the cause
<ineb>
Burgestr_: any way to make it parallel quickly?
<ytti>
IO does not suffer from GIL?
<Burgestr_>
ytti you can read and write in parallel on different threads
cfec0b8d has quit [Remote host closed the connection]
<Burgestr_>
(for example)
<ytti>
i did not know that, i assumed everything is GILd
<Burgestr_>
ineb give JRuby a try to see if it makes a difference
jud^ has joined #ruby
<Burgestr_>
ytti this also applies to networking operations, e.g. http calls or calling out to your database
Dry_Lips has joined #ruby
Dry_Lips has quit [Changing host]
Dry_Lips has joined #ruby
<Burgestr_>
ineb what I mentioned is not necesarily *the* reason, perhaps your operations are simply not slow enough or context-switching in your case is perhaps expensive enough to outweigh the concurrency gains
Burgestr_ is now known as Burgestrand
<darix>
ytti: good IO libraries release the GIL when waiting for data
<darix>
and then signal back then they have their data
<Burgestrand>
ytti in addition, C extensions can explicitly unlock the GIL during expensive operations, I believe Ruby's BigNum does this for maths with large numbers for example
<ytti>
alright, live and learn, thanks
jud has quit [Ping timeout: 255 seconds]
<ineb>
Burgestrand: i dont know, i have 52 files with 779600 words and my script almost always takes ~10s
Cavedog has joined #ruby
DoubleMalt has joined #ruby
cfec0b8d has joined #ruby
DoubleMalt has quit [Read error: Connection reset by peer]
doublemalt_ has quit [Read error: Connection reset by peer]
<ineb>
more threads tend to be even slower. its depressing
<Burgestrand>
ineb definitely try JRuby, if you see a performance gain that changes drastically with the numbers of threads (for the better) then you're likely seeing the effects of c-ruby's limited parallelism
<Burgestrand>
ineb yeah, well, as you add more threads you also increase the time it takes to switch between them, which reduces the time you're doing the work you actually want to speed up :D
ben______ has quit [Ping timeout: 260 seconds]
andikr has quit [Remote host closed the connection]
<ineb>
ok i tried jruby and now my system hangs at 100% cpu
<ineb>
and i can turn off the heater
<ineb>
haha. is my script rigged?
<ineb>
Exception in thread "Ruby-0-Thread-51: wordCount.rb:1" java.lang.OutOfMemoryError: Java heap space
<dminuoso>
Burgestrand, indeed. I think the main case where the GIL is unlocked though is syscalls.
Cavedog has quit []
Cavedog has joined #ruby
<dminuoso>
Or GVL rather.
<Burgestrand>
hehe
<Burgestrand>
it has different names in the C source too as far as I can remember, not much need to be pedantic about it
<dminuoso>
(Which I guess makes sense, since syscalls are kind of "expensive" since they almost always guarantee a context switch)
<Burgestrand>
ineb that's surprising!
<Burgestrand>
ineb I'm trying to find somewhere on my system where the run time is actually significant to test it out myself, but I have too few source files :o
duncellyjr has joined #ruby
<dminuoso>
ytti, ^- btw think you might find that interesting.
<Burgestrand>
Feels like I'm missing a bunch of files…
<dminuoso>
At the end the whole point of the GVL is to protect the (thread-unsafe) internals of Ruby. At syscall thresholds all the Ruby invariants are held, so Ruby might as well release the GVL - this is quite great because the syscall will almost always invoke the OS scheduler.
pupsicle has joined #ruby
Cavedog has quit [Client Quit]
pupsicle has quit [Client Quit]
xall has quit [Quit: xall]
pupsicle2 has joined #ruby
<ineb>
Burgestrand: great, thanks
pupsicle2 has quit [Client Quit]
pupsicle has joined #ruby
shinnya has joined #ruby
rohitpaulk has joined #ruby
pupsicle has quit [Client Quit]
pupsicle has joined #ruby
mim1k has joined #ruby
pupsicle has quit [Client Quit]
pupsicle has joined #ruby
duncellyjr has quit []
snath has joined #ruby
iomotoko has quit [Quit: leaving]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snath has quit [Ping timeout: 246 seconds]
sleetdrop has quit [Quit: Computer has gone to sleep.]
im0nde has quit [Ping timeout: 240 seconds]
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cadillac_ has joined #ruby
hutch34 has joined #ruby
anisha_ has quit [Quit: This computer has gone to sleep]
yogg-saron has joined #ruby
jordanm has joined #ruby
mrconfused has joined #ruby
cadillac_ has quit [Remote host closed the connection]
cadillac_ has joined #ruby
cdg has joined #ruby
snath has joined #ruby
ben_____ has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
cdg_ has quit [Ping timeout: 246 seconds]
snath has left #ruby [#ruby]
bvcosta has joined #ruby
cadillac_ has quit [Quit: ERC (IRC client for Emacs 25.1.1)]
mim1k has quit [Ping timeout: 246 seconds]
cadillac_ has joined #ruby
DLSteve has joined #ruby
ben_____ has quit [Ping timeout: 255 seconds]
djbkd has joined #ruby
jameser has joined #ruby
tomphp has joined #ruby
tomphp has quit [Client Quit]
swills has joined #ruby
biberu has joined #ruby
knight33 has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
mrconfused has quit [Ping timeout: 260 seconds]
hashrocket has joined #ruby
<apeiros>
dminuoso: you have to read closely. it has. but that handler crashes.
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros>
that you get a reply at all is because it has a failsafe around it all.
<dminuoso>
apeiros: Ah well, I cant even remember where the repository is.
<dminuoso>
I have so many git-"place" accounts...
mark_66 has left #ruby ["PART #elixir-lang :PART #crystal-lang :PONG :weber.freenode.net"]
<apeiros>
hint, it starts with github.com/apeiros ;-)
<dminuoso>
apeiros: Do you know how many github accounts I have?
<dminuoso>
:|
<dminuoso>
I have like 5 or 6..
oleo has joined #ruby
mim1k has joined #ruby
blackmesa has joined #ruby
borodin has joined #ruby
griffindy has joined #ruby
tomphp has joined #ruby
chouhoulis has joined #ruby
tomphp has quit [Client Quit]
<apeiros>
dminuoso: well, that's kinda your problem :-p
<apeiros>
I have 1
<apeiros>
and for everything else, there's organisations
aaoiki has joined #ruby
oliv_____ has quit [Remote host closed the connection]
jgnagy has joined #ruby
oliv_____ has joined #ruby
aaoiki has quit [Client Quit]
jphase has joined #ruby
tomphp has joined #ruby
enterprisey has joined #ruby
cdg has quit [Ping timeout: 246 seconds]
tomphp has quit [Client Quit]
sleetdrop has joined #ruby
GinoMan has joined #ruby
__Yiota has joined #ruby
mim1k has quit [Ping timeout: 268 seconds]
djbkd has quit [Read error: Connection reset by peer]
jameser has joined #ruby
CrazyEddy has joined #ruby
Terens has quit []
ur5us has joined #ruby
ben__ has joined #ruby
antgel has quit [Ping timeout: 240 seconds]
jjaii9 has joined #ruby
psychicist__ has quit [Ping timeout: 255 seconds]
gusrub has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
rkazak has joined #ruby
rkazak has quit [Client Quit]
jameser_ has joined #ruby
jameser has quit [Ping timeout: 240 seconds]
ben__ has quit [Ping timeout: 240 seconds]
mrconfused has joined #ruby
gusrub has quit [Ping timeout: 246 seconds]
blackwind_123 has quit [Quit: Hard work pays off in the future, laziness pays off now]
renchan_ has joined #ruby
Ishido has joined #ruby
renchan has quit [Read error: Connection reset by peer]
charliesome has joined #ruby
mim1k has joined #ruby
cfec0b8d has quit [Quit: Leaving]
cfec0b8d has joined #ruby
cfec0b8d has quit [Remote host closed the connection]
charliesome has quit [Client Quit]
cfec0b8d has joined #ruby
rkazak has joined #ruby
gheegh has joined #ruby
marr has joined #ruby
rkazak has quit [Client Quit]
cadillac_ has quit [Ping timeout: 255 seconds]
charliesome has joined #ruby
clouvet has joined #ruby
blackmesa has quit [Quit: WeeChat 1.6]
rkazak has joined #ruby
arup_r has joined #ruby
antgel has joined #ruby
clouvet has quit [Client Quit]
oliv_____ has quit [Remote host closed the connection]
oliv_____ has joined #ruby
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ljarvis>
wtf, people have more that 1 github account?
aupadhye has quit [Ping timeout: 245 seconds]
<arup_r>
haha. to hide identity probably :)
blackwind_123 has joined #ruby
<arup_r>
I saw people to ask question by sharing anonymous gist, again to hide their identity.. They feel shy to ask. :D :D
rohitpaulk has quit [Ping timeout: 246 seconds]
<dminuoso>
No
<dminuoso>
At some point I forgot my password and was too lazy to reset
<dminuoso>
then I was forced to make a separate for the company
<dminuoso>
And then there were other reasons
swills has quit [Ping timeout: 255 seconds]
<ljarvis>
all very poor ones i see
<dminuoso>
I think lazyness is a good one.
gothicsouth has joined #ruby
jgnagy has quit [Remote host closed the connection]
ferr1 has quit [Quit: WeeChat 1.8]
mim1k has quit [Read error: Connection reset by peer]
rohitpaulk has joined #ruby
<arup_r>
dminuoso: you are different! :) I saw people .. like I said.. who also change their nickname ..
<dminuoso>
Heh....
<dminuoso>
I may have done that. :-)
LastWhisper____ has joined #ruby
<arup_r>
I worked with a guy .. who hired me from #rubyonrails .. worked with him 4-5 months.. and then last month $2200 he didn't pay. Then he makes excuses.. I somehow managed $1300 from him.. now $900 remaining ... and it seems like he is trying to bluff it :) He comes there to ask questions, and keep changing his nicknames.. I caught him 2 times.. And he said he is trying.. :) But now I don't know in which nickname he is prese
<arup_r>
nt.. I will see next 2 months, and then I will take him my way when I will see him online there.. ( Sorry I said this here to support why someone try to hide under name ) :D
<arup_r>
sorry again for posting this offtopic thing.
vondruch has quit [Ping timeout: 246 seconds]
<apeiros>
?ot arup_r
<ruby[bot]>
arup_r: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related topics. Thanks!
<dminuoso>
This is what happens when you work without a contract.
<dminuoso>
No liability whatsoever.
<arup_r>
apeiros: yes you are right! I mentioned it.. I just put a reasoning :)
<apeiros>
dminuoso: separate for the company? that's what organizations exist for :)
<apeiros>
unless you chose an unsuitable username of course…
<dminuoso>
apeiros: I was asked to not use my personal account for.. idk.
<dminuoso>
Reasons.
<apeiros>
reasons are the best
<arup_r>
haha
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jphase has quit []
oliv_____ has quit [Remote host closed the connection]
olivi____ has joined #ruby
YOUR_NIC has joined #ruby
<bvcosta>
What is the best way to do exception handling with ruby and puma? Should we bubble up the exception and have a global exception handler?
<dminuoso>
bvcosta: Catch exceptions where you can handle them.
<dminuoso>
!next
<dminuoso>
?next
<ruby[bot]>
dminuoso: I don't know anything about next
<dminuoso>
My thought is: if klass does not exist, it could simply walk the super chain until an RClass with a klass ptr != null exists.
<dminuoso>
But...
<dminuoso>
no.
<dminuoso>
This is really screwed up for when you do
cschneid_ has joined #ruby
ben__ has joined #ruby
<apeiros>
I'm afraid, I don't know the C impl specifics
<apeiros>
banisterfiend would probably know
<dminuoso>
apeiros: Funny fact, did you know that internally "metaclass" is used for singleton classes of classes, and "singleton class" for singleton classes of objects?
clouvet has quit [Client Quit]
<apeiros>
heh, no, didn't
<apeiros>
I still think they should've gone with eigenclass
hobodave has joined #ruby
<dminuoso>
Mmm.
jgnagy has joined #ruby
<dminuoso>
Yeah, the lack of German words in todays inventions is really dissatisfying.
Fernando-Basso has quit [Quit: WeeChat 1.8]
rkazak has quit [Quit: Sleep.....ing....]
ben__ has quit [Ping timeout: 255 seconds]
rkazak has joined #ruby
Pumukel has quit [Ping timeout: 240 seconds]
mostlybadfly has quit [Quit: Connection closed for inactivity]
synthroi_ has quit [Remote host closed the connection]
brent__ has joined #ruby
roshanavand has quit [Quit: roshanavand]
bvcosta has quit [Remote host closed the connection]
rippa has joined #ruby
bvcosta has joined #ruby
synthroid has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
jackjackdripper has joined #ruby
yeticry has joined #ruby
swills has joined #ruby
yeticry_ has quit [Ping timeout: 255 seconds]
boombox_ has joined #ruby
amclain has joined #ruby
swills has quit [Ping timeout: 255 seconds]
ben__ has joined #ruby
Burgestrand has quit [Quit: Closing time!]
tvw has quit [Read error: Connection reset by peer]
duderonomy has quit [Ping timeout: 246 seconds]
enterprisey has quit [Remote host closed the connection]
ben__ has quit [Ping timeout: 246 seconds]
bkxd has joined #ruby
cdg has joined #ruby
gusrub has joined #ruby
vondruch has joined #ruby
bkxd has quit [Ping timeout: 255 seconds]
boombox_ has quit [Remote host closed the connection]
dasher00 has quit [Ping timeout: 255 seconds]
ur5us has joined #ruby
nowhereman has quit [Ping timeout: 260 seconds]
cadillac_ has joined #ruby
aufi has quit [Quit: Leaving]
Alex9 has joined #ruby
ur5us has quit [Ping timeout: 268 seconds]
cadillac__ has joined #ruby
quobo has joined #ruby
dasher00 has joined #ruby
cadillac_ has quit [Ping timeout: 246 seconds]
oliv_____ has quit [Remote host closed the connection]
t-recx has joined #ruby
oliv_____ has joined #ruby
mim1k has quit [Ping timeout: 255 seconds]
DLSteve has joined #ruby
DeeJayh has joined #ruby
ddffg has quit [Ping timeout: 240 seconds]
<Alex9>
Do most people use Ruby for web applications?
chalkmonster has joined #ruby
mrconfused_ has joined #ruby
<dminuoso>
Alex9: A fair share probably do.
mrconfused has quit [Remote host closed the connection]
<dminuoso>
Alex9: However Ruby is also widely used in other environments like Chef or Puppet.
<Alex9>
dminuoso That's great to know, I'm thinking of picking Ruby up as my next language. :)
oliv_____ has quit [Remote host closed the connection]
olivi____ has joined #ruby
olivi____ has quit [Remote host closed the connection]
jackjackdripper has quit [Quit: Leaving.]
olivi____ has joined #ruby
nanoz has joined #ruby
nanoz has joined #ruby
nanoz has quit [Changing host]
gusrub has quit [Remote host closed the connection]
gusrub has joined #ruby
gusrub has quit [Remote host closed the connection]
<dminuoso>
(Ruby does not do hierarchy based lookup for constants, it does nesting based lookup)
<jdsampayo>
thanks! I think this does the magic: WRAPPERS.class_eval{ Account }
<dminuoso>
jdsampayo: Ughhhhh....
<dminuoso>
jdsampayo: Please no.
<dminuoso>
Though I gotta admire the creativity..
<jdsampayo>
D:
<dminuoso>
jdsampayo: Let me stare at this for a while while you read up on nesting.
PaulCapestany has quit [Ping timeout: 255 seconds]
<dminuoso>
jdsampayo: Am I right in assuming in lines 27 and 33 you meat Soap::V1::Actions rather than Soap::V1::Base ?
uZiel has quit [Ping timeout: 248 seconds]
PaulCapestany has joined #ruby
<jdsampayo>
sure, you are right! error copying
Rodya_ has joined #ruby
<jdsampayo>
I think I can also solve it if I could get the name of the includers inside of the concern, to decide if using one path or another
<dminuoso>
jdsampayo: Once you have read and understood I will give you the answer (it's done, so whenever you are ready)
<dminuoso>
jdsampayo: Much simpler than what you are thinking.
<dminuoso>
There is a simple way to express exactly what you are doing with minimal change, but I'd like you to understand why your approach failed.
cjhowe7 has joined #ruby
ascarter_ has quit [Ping timeout: 255 seconds]
GinoMan has joined #ruby
mcafee has joined #ruby
duderonomy has joined #ruby
learningruby has joined #ruby
andrzejk_ has joined #ruby
<learningruby>
Variables and method names are often referred in separate in Ruby books. But ain't a method name just a variable holding the method body?
<elomatreb>
No, a method is a method and a variable is a variable. Technically completely different, just look similar in syntax
<dminuoso>
learningruby: No.
<dminuoso>
learningruby: Ruby has a mechanism by which it lexographically (think like "during parsing") it learns whether an identifier is either a variable or a method.
<dminuoso>
learningruby: When it sees something like a = <something> it then treats "a" as a local variable for the rest of the scope.
<dminuoso>
Otherwise it treats it as a method.
<elomatreb>
But not `a()`
<jdsampayo>
@dminuso my aproach failed because at the execution of included, I'm on a different scope:
<dminuoso>
learningruby: and a method foo is basically self.send(:foo), whereas a variable is kind-of like local_variable_get(:foo)
<dminuoso>
jdsampayo: ^- you can this to invoke a completely dynamic way of obtaining a const.
renchan_ has quit [Quit: Leaving...]
ascarter has quit [Read error: Connection reset by peer]
<dminuoso>
This will bypass any nesting rules, and let you specify exactly where it should search.
ascarter has joined #ruby
<mcafee>
Question: Is there a method one can call on an array that returns nil if the array is empty, otherwise it returns the array? I have a function that looks like arr = (...big function call...); arr.empty? ? nil : arr; and I wish I could turn it into a single expression.
glejeune has quit [Ping timeout: 258 seconds]
<havenwood>
>> def meth; 42 end; var = 42; "meth is a #{defined? meth} and var is a #{defined? var}" # learningruby
<ruby[bot]>
havenwood: # => "meth is a method and var is a local-variable" (https://eval.in/813576)
rgr_ has joined #ruby
<dminuoso>
jdsampayo: A regular constant-lookup is basically nesting.each { |n| break n.const_get(:CONSTANT) if n.const_defined?(:CONSTANT) } (it's contrived, but conceptually it works)
<dminuoso>
And if that returns nil, it starts to look for const_missing hooks, and if that fails, it throws an exception
<dminuoso>
And there's no way you can resolve that in your situation.
<jdsampayo>
@diminuso I think my problem now is that even I could get the const_get to dynamically load the class needed, the concern is not getting the constant of the includer, so I need to in someway pass a variable / attribute to the Concern
rgr has quit [Ping timeout: 246 seconds]
<dminuoso>
jdsampayo: Im not really 100% certain about Rails concerns - I prefer to use raw Ruby modules because I consider concerns silly.
nitric has joined #ruby
<dminuoso>
>> module M; Q = 1; end; class C; include M; puts const_get(:Q); end # jdsampayo
<ruby[bot]>
dminuoso: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<dminuoso>
There's network connections.
<havenwood>
#=> 1
<dminuoso>
This will return: #=> 1
<dminuoso>
Thank you havenwood.
<havenwood>
Actually I should be a better REPL:
<havenwood>
#>> 1
<havenwood>
#=> nil
<dminuoso>
:)
BTRE has quit [Ping timeout: 240 seconds]
<dminuoso>
jdsampayo: But Im fairly sure it should also work with Rails concerns.
Guest99989 has quit [Read error: Connection reset by peer]
<dminuoso>
(They are just sugar coated ruby moduleS)
cfec0b8d has joined #ruby
ben__ has joined #ruby
djbkd has quit [Remote host closed the connection]
romank has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
jdsampayo: Oh it just hit me. You will have to do const_get twice.
olivi____ has quit [Remote host closed the connection]
oliv_____ has joined #ruby
<dminuoso>
Or might. Im not sure.
<DTZUZU>
anyone hiring out there
shinnya has quit [Ping timeout: 260 seconds]
<dminuoso>
havenwood>> module M; module N; Q = 1; end; end; end; class C; include M; puts const_get("N::Q"); end
gusrub has joined #ruby
<dminuoso>
havenwood uses GraalVM - long warmup.
r8 has joined #ruby
ben__ has quit [Ping timeout: 268 seconds]
nchambers has quit [Changing host]
nchambers has joined #ruby
modin has quit [Ping timeout: 260 seconds]
<dminuoso>
>> module M; Q = 1; end; module N; P = M; end; class C; include M; puts const_get("N::P::Q"); end # jdsampayo
<jdsampayo>
@diminuoso following your example I think the problem I have is the inverse, try to get a constant defined in C inside N
<dminuoso>
no this works fine.
nchambers has quit [Changing host]
<jdsampayo>
I mean, the controller defines the Wrapper Path, after defining the constant include the Concern and make the Concern to use it in the included block
nchambers has joined #ruby
nchambers is now known as mewtwo
mcafee has quit [Quit: ERC (IRC client for Emacs 26.0.50)]
<jdsampayo>
somewhat of "passing a variable to a concern", probably
<jdsampayo>
but in the included block, the nesting does not know anything about the controller
Rodya_ has quit [Remote host closed the connection]
Rodya_ has joined #ruby
antgel has quit [Ping timeout: 255 seconds]
mtkd has quit [Ping timeout: 246 seconds]
<learningruby>
thanks diminuoso and havenwood for the answers : )
<dminuoso>
jdsampayo: Too much abstract talk. Give me a test case.
<dminuoso>
jdsampayo: use eval.in if you want.
mtkd has joined #ruby
<r8>
If my program may be installed anywhere in the filesystem, how do I 'require' in a way that gets me the libraries I ship with it? I think require_relative is supposed to help with this?
<jdsampayo>
sorry, let me try to make it less fuzzy
ikoma has quit [Remote host closed the connection]
<r8>
dminuoso: What if my app's libraries aren't in the $LOAD_PATH?
<dminuoso>
r8: Use the RUBYLIB environment variable
<dminuoso>
r8: And have the outside world deal with where it is. It's not your programs responsibility to figure out where a library is.
GinoMan has quit [Ping timeout: 246 seconds]
<r8>
dminuoso: What's require_relative for?
Rodya_ has quit [Remote host closed the connection]
<dminuoso>
r8: say you are inside a lib/car/engine/rotor.rb, and you need to get hold of lib/car/electronics.rb
<r8>
dminuoso: So when I deliver my app to operations, I tell them they need to set their environment so they can run my program? Surely there's a way for the program or Ruby to figure out that the libraries are ../lib from the program itself?
gusrub has quit [Remote host closed the connection]
<dminuoso>
r8: If the ruby libraries are not in the LOAD_PATH, you are out of luck unless there's some convention or way to guess where they might end up in.
<dminuoso>
r8: Or you could search the entire filesystem.
<r8>
ha
SaschaVoid has quit [Quit: die();]
<dminuoso>
r8: The better solution would be to actually use gems properly.
<dminuoso>
r8: Have some gem server set up that contains the libraries, and then you can use gemspec/bundler to pull in the dependencies as needed.
<dminuoso>
(or if the libraries are not IP, upload them to rubygems.org)
<r8>
dminuoso: My program and its libraries are basically a unit...
<dminuoso>
r8: Oh so you ship the libraries yourself?
mewtwo is now known as nchambers
<r8>
dminuoso: Yeah, sorry, should have clarified.
<dminuoso>
r8: Just push things onto $LOAD_PATH :)
t-recx has quit [Quit: t-recx]
<dminuoso>
And then require as usual
<jdsampayo>
@dminuoso you are a genious, it worked! see:
Fysicus has joined #ruby
gothicsouth has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
cdg has quit [Remote host closed the connection]
<r8>
dminuoso: Something like get dir of my program, push "#{dir}/../lib" onto $LOAD_PATH?
<dminuoso>
r8: You can use Kernel#__dir__ to help you :)
<dminuoso>
r8: Or use require_relative -> both options are fine. I would use the LOAD_PATH approach if you ever plan to extract the libraries into separate gems.
<jdsampayo>
@diminuoso, this was the trick as you pointed out: soap_path.const_get("Account")
GinoMan has joined #ruby
<jdsampayo>
@dminuoso, but it needs to be a String! as the documentation you sent me, not a Class like I was doing
<dminuoso>
jdsampayo: Btw, use symbols for single constants without namespace qualifiers.
<dminuoso>
Or.. Im not certain now. Let me check
<dminuoso>
jdsampayo: Yes absolutely use a symbol! :)
<jdsampayo>
@dminuoso thanks! it works also with the Symbol
<dminuoso>
jdsampayo: Yeah only for immediate constants. I dont think it works with nested constants looking at the C code.
<dminuoso>
jdsampayo: The symbol approach is much faster. :)
workmad3 has quit [Ping timeout: 240 seconds]
<dminuoso>
Crazy buttloads faster.
nowhereman has quit [Ping timeout: 260 seconds]
<jdsampayo>
@dminuoso, lol, sure, keeping the symbol, this was exactly what I needed, thank you very much, you saved a project to duplicate LOT of files only to change a SOAP serializer response, hope you have a great day, will be around
<r8>
dminuoso: I like your idea. I may do this: $LOAD_PATH.push(File.dirname(__FILE__) + '/../lib')
mrconfused has joined #ruby
petruff1 has joined #ruby
Rodya_ has joined #ruby
Cohedrin has joined #ruby
gusrub has joined #ruby
petruff has quit [Ping timeout: 260 seconds]
gothicsouth has joined #ruby
<r8>
dminuoso: Or maybe $LOAD_PATH.insert(). Thanks for your help.
haylon has joined #ruby
<dminuoso>
r8: Indeed. And if you don't want public access to that, you can remove that path after setting up your library again.
ben__ has joined #ruby
rohitpaulk has joined #ruby
ur5us has quit [Ping timeout: 255 seconds]
Rodya_ has quit [Remote host closed the connection]
mrconfused has quit [Ping timeout: 260 seconds]
ryzokuken has quit [Quit: Leaving]
oliv_____ has quit [Remote host closed the connection]
r8 has quit [Quit: Thanks!]
olivi____ has joined #ruby
<haylon>
Has anyone had any luck with Microsoft Teams and making a bot using Ruby?
mrconfused has joined #ruby
ben__ has quit [Ping timeout: 246 seconds]
glejeune has joined #ruby
nchambers has quit [Changing host]
nchambers has joined #ruby
Rodya_ has joined #ruby
nchambers has quit [Changing host]
nchambers has joined #ruby
psychicist__ has quit [Quit: leaving]
psychicist__ has joined #ruby
chalkmonster has quit [Quit: Daddy's flown, 'cross the ocean.]
rohitpaulk has quit [Ping timeout: 255 seconds]
hutch34 has quit [Ping timeout: 255 seconds]
Cohedrin has quit [Read error: Connection reset by peer]
jdawgaz has joined #ruby
Bock has quit [Remote host closed the connection]
Cohedrin has joined #ruby
djbkd has joined #ruby
justizin has joined #ruby
mikecmpbll has joined #ruby
elcontrastador has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<justizin>
getting this error that typically indicates xcode missing, when it's not (trying to gem install mysql2 on macos sierra) : "ld: library not found for -l-lpthread", anyone know anything else i might wanna check?
<justizin>
i'm kinda wondering, is it possible i need to remove and install xcode command line tools fresh? not sure i've ever encountered that, but a first time for everything..
ben__ has joined #ruby
joevandyk has joined #ruby
GinoMan2440 has joined #ruby
ozzy3 has joined #ruby
andrzejk_ has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
muelleme has joined #ruby
jamesaxl has quit [Read error: Connection reset by peer]
GinoMan1423 has joined #ruby
SeepingN has joined #ruby
Rodya_ has quit [Ping timeout: 260 seconds]
<dminuoso>
justizin: xcode?
<dminuoso>
You are brave.
<havenwood>
justizin: What do you get for?: xcode-select --version
<ozzy3>
hello
<havenwood>
ozzy3: hi
cfec0b8d has quit [Remote host closed the connection]
* dminuoso
ended up custom patching a GCC because he got sick of this apple stuff
<justizin>
havenwood: "xcode-select version 2347."
<havenwood>
justizin: So you have the latest command line tools installed.
GinoMan1423 has quit [Client Quit]
<justizin>
havenwood: but i'm thinking, maybe that install had a silent failure? it should provide pthread, yah?
GinoMan has quit [Ping timeout: 240 seconds]
cfec0b8d has joined #ruby
<havenwood>
justizin: gcc --version #=> 8.1.0?
<ozzy3>
how can i try ruby codes pc free
<justizin>
havenwood: si
ben__ has quit [Ping timeout: 268 seconds]
<borodin>
is there any way to convert a string into an attribute name? i.e. if varattr="size" then big_aray.varattr gives the size of big_array?
hashrocket has quit [Quit: Connection closed for inactivity]
KeyJoo has joined #ruby
zapata has joined #ruby
Cohedrin has quit [Read error: Connection reset by peer]
<morfin>
hmm
sagax has quit [Remote host closed the connection]
gusrub has quit [Remote host closed the connection]
milardovich has joined #ruby
<morfin>
i changed directory to tmp dir created by rbenv and did make install should not that properly install whole thing?
jackjackdripper has quit [Quit: Leaving.]
Cohedrin has joined #ruby
jackjackdripper has joined #ruby
milardovich has quit [Remote host closed the connection]
mrconfused has quit [Ping timeout: 260 seconds]
gusrub has joined #ruby
bvcosta has quit [Remote host closed the connection]
jdawgaz has joined #ruby
bvcosta has joined #ruby
andrzejk_ has joined #ruby
mrconfused has joined #ruby
bvcosta has quit [Ping timeout: 260 seconds]
jgt4 has quit [Ping timeout: 246 seconds]
Rodya_ has quit [Remote host closed the connection]
raspado has joined #ruby
oliv_____ has quit [Remote host closed the connection]
oliv_____ has joined #ruby
cdg has quit [Remote host closed the connection]
cdg has joined #ruby
cyclonis has quit [Quit: leaving]
jdsampayo has joined #ruby
arup_r has joined #ruby
AndChat|474201 has joined #ruby
AndChat|474201 has quit [Max SendQ exceeded]
patr0clus has quit [Read error: Connection reset by peer]
patr0clus has joined #ruby
patr0clus has quit [Max SendQ exceeded]
oliv_____ has quit [Remote host closed the connection]
oliv_____ has joined #ruby
jgt4 has joined #ruby
ltem has quit [Quit: Leaving]
belmoussaoui has quit [Read error: Connection reset by peer]
HoierM has quit [Ping timeout: 255 seconds]
dionysus69 has joined #ruby
belmoussaoui has joined #ruby
gusrub has quit [Remote host closed the connection]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
mtkd has quit [Ping timeout: 260 seconds]
mtkd has joined #ruby
jamesaxl has quit [Quit: WeeChat 1.7.1]
jgt4 has quit [Ping timeout: 240 seconds]
shinnya has joined #ruby
arup_r has quit [Remote host closed the connection]
ben__ has joined #ruby
synthroi_ has joined #ruby
djbkd has quit [Remote host closed the connection]
djbkd has joined #ruby
ur5us has joined #ruby
synthroid has quit [Ping timeout: 246 seconds]
ben__ has quit [Ping timeout: 268 seconds]
djbkd has quit [Ping timeout: 268 seconds]
ur5us has quit [Ping timeout: 240 seconds]
synthroid has joined #ruby
polysics has joined #ruby
bvcosta has joined #ruby
synthroi_ has quit [Ping timeout: 258 seconds]
Kug3lis has joined #ruby
bvcosta has quit [Remote host closed the connection]
bvcosta has joined #ruby
Kug3lis has quit [Remote host closed the connection]
Kug3lis has joined #ruby
bvcosta has quit [Ping timeout: 255 seconds]
ozzy3 has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
ecuanaso has joined #ruby
DeeJayh has quit [Read error: Connection reset by peer]
mrconfused has quit [Ping timeout: 246 seconds]
<morfin>
something is wrong with stderr
<morfin>
i tried running command which do install stuff and seems like stderr printed before stdout oO
mrconfused has joined #ruby
tomphp has joined #ruby
modin has joined #ruby
<sonOfRa>
morfin: stdout is buffered, stderr is generally not buffered
DeeJayh has joined #ruby
<sonOfRa>
Generally stdout is line-buffered, so if a newline is encountered, the buffer is generally written, but stderr is generally written *immediately*
<morfin>
ah i forgot
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<morfin>
my ruby-build fails for 2.2.0 with error ENOENT(but file exists) and 2.3.0 does nothing after install
Cohedrin has quit [Read error: Connection reset by peer]
<morfin>
ruby can't work with not real path?
tomphp has quit [Ping timeout: 240 seconds]
jdawgaz has joined #ruby
<morfin>
File.read(fake) # this fails with fake = "/tmp/ruby-build.20170608005404.5048/ruby-2.2.0/tools/fake.rb"
psychicist__ has quit [Ping timeout: 246 seconds]
Cohedrin has joined #ruby
<dminuoso>
sonOfRa. I thought I knew your name from somewhere. :-)
* sonOfRa
waves
<sonOfRa>
I'm all over the place!
synthroi_ has joined #ruby
itaipu has quit [Ping timeout: 260 seconds]
<morfin>
HAHAHAHAAHAHAH
synthroid has quit [Ping timeout: 246 seconds]
<morfin>
fuck me
bmurt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<sonOfRa>
I'd much rather not
<morfin>
i found ruby 2.2.0 and 2.3.0 installed in D:/home
<dminuoso>
sonOfRa: Since you only stated a preference, does that still make you open to the proposition?
<morfin>
how the heck it's possible?
<dminuoso>
I mean it was not a categorical no...
<morfin>
how when i build inside of Msys2 in mingw64 session it resolve path to real /
ur5us has joined #ruby
oliv_____ has quit [Remote host closed the connection]
mim1k has quit [Ping timeout: 246 seconds]
<morfin>
or that's just mintty detect path as /?
workmad3 has quit [Ping timeout: 255 seconds]
olivi____ has joined #ruby
<morfin>
so outside of mintty / => D:/
<sonOfRa>
dminuoso: I never ever make categorical statements!
bkxd has joined #ruby
itaipu has joined #ruby
<morfin>
msys2 do some magic
<dminuoso>
sonOfRa: I think the "ever" was over the top.
gusrub has joined #ruby
<sonOfRa>
Maybe.
tomphp has joined #ruby
muelleme has quit [Ping timeout: 245 seconds]
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
anomaly has joined #ruby
stephenh has joined #ruby
bkxd has quit [Ping timeout: 246 seconds]
<anomaly>
I am taking two inputs. I can print the interpolated strings just fine. however I want to then also print "The count was " but neither assigning count = input.length or #{input.length} are working. What am I missing?
synthroi_ has quit []
nadir has quit [Quit: Connection closed for inactivity]
<morfin>
guys, do you have any idea - is that miniruby issue?
<morfin>
why it thinks it's out of box and use real directories
<elomatreb>
anomaly: We'll need your code, preferrably on gist.github.com
<elomatreb>
anomaly: Try and see what `puts` returns (e.g. in irb/pry)
<stephenh>
normally at this point I would just look at the file in the gem, but thought I would ask if there was a way to, like, discover methods available on an object rather than always looking at the code itself
MrBismuth has joined #ruby
<elomatreb>
stephenh: Almost all objects have #methods
<stephenh>
awesome, that worked!
jenrzzz has quit [Ping timeout: 246 seconds]
<stephenh>
mystery solved, thanks!
<elomatreb>
If you pass it true as an argument it won't show inherited methods btw
<anomaly>
`<main>': undefined method `length' for nil:NilClass (NoMethodError)
olivi____ has quit [Remote host closed the connection]
oliv_____ has joined #ruby
prubini87 has joined #ruby
ben__ has joined #ruby
<anomaly>
elomatreb: pardon my not grasping the meaning. that was not interpolated strings. I can take a string like count = "this is a sentence".length puts count and it works. it seems the problem is with the interpolated strings.
dviola has quit [Quit: WeeChat 1.8]
polysics has quit []
<elomatreb>
No, it's just that puts does not return its argument (the interpolated string), but rather nil
faelkle has joined #ruby
faelkle has joined #ruby
faelkle has quit [Changing host]
poloych has joined #ruby
spcmao has joined #ruby
jenrzzz has joined #ruby
faelkle has quit [Client Quit]
SCHAPiE has quit [Read error: Connection reset by peer]
ben__ has quit [Ping timeout: 260 seconds]
[Butch] has quit [Quit: I'm out . . .]
Qommand0r has joined #ruby
SCHAPiE has joined #ruby
cjhowe7 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has quit [Ping timeout: 246 seconds]
boombox_ has joined #ruby
<dminuoso>
elomatreb: You can also use havenwood, our new repl.
<ruby[bot]>
dminuoso: # => /tmp/execpad-7898aceafbd4/source-7898aceafbd4:2: warning: don't put space before argument parenthese ...check link for more (https://eval.in/813645)
<dminuoso>
SeepingN: It selects the Ruby version 1.8
<elomatreb>
That's what #methods does, but since you can't predict what method_missing may do, those won't show up
<elomatreb>
stephenh: ^
<SeepingN>
ohhhh
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<dminuoso>
SeepingN: There's a handful of other modifiers