ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nofxxxx has quit [Quit: Leaving]
ecuanaso has joined #ruby
nofxx has joined #ruby
kt has quit [Ping timeout: 260 seconds]
t-recx has quit [Quit: t-recx]
ujjain has quit [Ping timeout: 260 seconds]
brent__ has joined #ruby
ujjain has joined #ruby
ujjain has joined #ruby
ujjain has quit [Changing host]
kt has joined #ruby
s1kx has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
eightlimbed has joined #ruby
brent__ has quit [Ping timeout: 240 seconds]
astrobunny has joined #ruby
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bronson has joined #ruby
gusrub has quit [Remote host closed the connection]
marr has quit [Ping timeout: 248 seconds]
perry has quit [Ping timeout: 260 seconds]
bronson has quit [Ping timeout: 240 seconds]
jordanm has joined #ruby
perry has joined #ruby
perry has quit [Changing host]
perry has joined #ruby
AndBobsYourUncle has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
catphish has joined #ruby
<catphish>
is it reasonable to assume that a BigDecimal can be expressed as 2 integers? if so, is there any way to extract those 2 integers from a BigDecimal instance?
jameser has joined #ruby
bruno- has quit [Ping timeout: 240 seconds]
hinbody has joined #ruby
roa has joined #ruby
<nofxx>
catphish, isn't that the same as "any number can be expressed as 2 integers" ...which is very false?
<catphish>
nofxx: well not any number, only those with exact decimal representations
brian_penguin has quit [Read error: Connection reset by peer]
<catphish>
ie the kinds of numbers that bigdecimal can store
hinbody has quit [Read error: Connection reset by peer]
Guest53 has joined #ruby
gizmore has quit [Ping timeout: 248 seconds]
ecuanaso has joined #ruby
hahuang61 has joined #ruby
alfiemax has joined #ruby
cam27_ has joined #ruby
astrobun_ has joined #ruby
Caius has quit [Ping timeout: 240 seconds]
yosafbridge has quit [Quit: Leaving]
Caius has joined #ruby
Caius has joined #ruby
Caius has quit [Changing host]
Guest89737 has quit [Ping timeout: 246 seconds]
hahuang65 has quit [Ping timeout: 240 seconds]
heinrich5991 has quit [Ping timeout: 240 seconds]
eam has quit [Ping timeout: 240 seconds]
eam has joined #ruby
astrobunny has quit [Ping timeout: 240 seconds]
ljarvis has quit [Ping timeout: 240 seconds]
cam27 has quit [Ping timeout: 240 seconds]
cam27_ is now known as cam27
naprimer has quit [Ping timeout: 240 seconds]
bmurt has joined #ruby
yosafbridge has joined #ruby
<purple_apple>
what other reason is there to implement all lib code in bin/blah except to make life difficult? Kernel.load `where.exe blah`.each_line.first.chomp
leonthemisfit has quit [Ping timeout: 260 seconds]
cydrobolt has joined #ruby
cydrobolt has joined #ruby
cydrobolt has quit [Changing host]
naprimer has joined #ruby
ljarvis has joined #ruby
alfiemax has quit [Ping timeout: 255 seconds]
milardovich has quit [Remote host closed the connection]
leonthemisfit has joined #ruby
leonthemisfit has joined #ruby
leonthemisfit has quit [Changing host]
milardovich has joined #ruby
<purple_apple>
frustrating software is frustrating
Guest53 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
heinrich5991 has joined #ruby
hinbody has joined #ruby
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eightlimbed has joined #ruby
ur5us has joined #ruby
cam27 has quit [Quit: cam27]
shwouchk has joined #ruby
knight33 has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
govg has quit [Ping timeout: 240 seconds]
mikeiniowa has joined #ruby
gusrub has joined #ruby
SqREL has joined #ruby
cam27 has joined #ruby
SqREL has quit [Ping timeout: 240 seconds]
Guest53 has joined #ruby
Guest53 has quit [Client Quit]
Guest53 has joined #ruby
Guest53 has quit [Client Quit]
armando has joined #ruby
enterprisey has joined #ruby
jgorak has joined #ruby
gusrub has quit [Remote host closed the connection]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Guest96479 is now known as Cyrus
Cyrus has quit [Changing host]
Cyrus has joined #ruby
knight33 has joined #ruby
knight33 has quit [Ping timeout: 248 seconds]
ledestin has joined #ruby
Rodya_ has joined #ruby
<jgorak>
Hi. Can someone help me with gem confusion? I set GEM_PATH=~/.gem:/var/lib/gems/2.4.0/gems and GEM_HOME=~/.gem expecting to have a user-owned gem directory that falls back to the system one if I don't have a gem. Instead, when I set both, I end up seeing only like 5 gems (those mentioned in /usr/lib/ruby/gems/2.4.0/specifications/default). Setting either 1 or the other I see the gems I expect. Any ideas?
<jgorak>
(also confirmed than gem env looks as I'd expect for the home/path)
runescape07rsps has joined #ruby
claw has quit [Read error: Connection reset by peer]
<nofxx>
jgorak, if you're using ~/.gem no need for that.... erase it all, just add gem homem to your $PATH to use executables in /bin
<nofxx>
what's your distro? check /etc/gemrc
<nofxx>
there's problably --user-install there, so it'll use ~/.gem, no questions asked
uZiel has joined #ruby
<nofxx>
let me rephrase better: you don't need to worry with gem vars, you just need path to bin (eg ~/.gem/ruby/2.4.0/bin) in your $PATH
<nofxx>
export GEM_HOME=$(ruby -rubygems -e "puts Gem.user_dir") and add $GEM_HOME/bin in $PATH
gusrub has joined #ruby
<nofxx>
I wish we could have ~/.gem/ruby/bin ln to latest ...
<jgorak>
Aha. For some reason, I was trying to use GEM_HOME in place of --user-install... I think I get it now. Default path + --user-install sounds like what I need, thanks!
gusrub has quit [Client Quit]
<jgorak>
(On linux mint, btw, and no sign of a gemrc, but its ok if this setup works for me :)
claw has joined #ruby
<nofxx>
jgorak, /etc/gemrc: "gem: --user-install"
<nofxx>
jgorak, and any other arg you don't want to type everytime
<nofxx>
or create a ~/.gemrc
<jgorak>
gotcha. Came across mention of ~/.gemrc the other day, but opted for the env variables/bashrc when i didn't see the matching /etc entry
MarkBilk has joined #ruby
cadillac_ has quit [Quit: I quit]
cadillac_ has joined #ruby
uZiel has quit [Ping timeout: 268 seconds]
<nofxx>
jgorak, truth is debian likes to agree on disagree on everything... heh
<nofxx>
in the mint line, check out manjaro if you didn't
<jgorak>
Never heard of it. Taking a look now. I'm just refugeeing here for a while to take a break from gentoo and see what's out there :)
hinbody has quit [Quit: leaving]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cam27 has quit [Quit: cam27]
cdg has joined #ruby
Fenhl has joined #ruby
dymaxion_ has joined #ruby
cdg has quit [Ping timeout: 246 seconds]
m27frogy has joined #ruby
dymaxion_ has quit [Ping timeout: 248 seconds]
<jgorak>
Now I'm looking back at my confusion like I was tangled up in my own shirt. Shouldn't have been that hard. But now my tests look like things are working like they should. Thanks again
eightlimbed has quit [Ping timeout: 264 seconds]
Guest53 has joined #ruby
Guest53 has quit [Client Quit]
NeverTired has quit [Quit: Connection closed for inactivity]
Rodya_ has quit [Remote host closed the connection]
uZiel has joined #ruby
sleepee has joined #ruby
raul782 has joined #ruby
code_zombie has quit [Quit: Leaving]
Guest53 has joined #ruby
bronson has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
bronson has quit [Ping timeout: 240 seconds]
gix has quit [Ping timeout: 260 seconds]
gix has joined #ruby
uZiel has quit [Ping timeout: 268 seconds]
_whitelogger has joined #ruby
Guest53 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
antoniobeyah has quit [Quit: Connection closed for inactivity]
milardovich has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
<catphish>
is it reasonable to assume that a BigDecimal can be expressed as 2 integers? if so, is there any way to extract those 2 integers from a BigDecimal instance?
frozengeek has quit [Quit: frozengeek]
frozengeek has joined #ruby
nadir has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
roshanavand has joined #ruby
laphoraig92 has joined #ruby
cdg has joined #ruby
xall has joined #ruby
<dminuoso>
catphish: no
<dminuoso>
catphish: What you are talking about is called Rational
<dminuoso>
BigDecimal is just a generalization from float/double
<dminuoso>
catphish: You can still convert a BigDecimal into a rational with to_r but you have an implicit loss of precision for obvious reasons
nacsurte has joined #ruby
cdg has quit [Ping timeout: 246 seconds]
<jokke>
hmm i've narrowed my problem with threading and rspec hanging to simplecov
nacsurte has quit [Ping timeout: 240 seconds]
<jokke>
if i don't require it, no problem
jaruga has joined #ruby
phatypus_ has joined #ruby
phatypus_ is now known as phatypus
ur5us has joined #ruby
vondruch has quit [Quit: vondruch]
astrobunny has joined #ruby
vondruch has joined #ruby
insomniac_ has joined #ruby
roshanavand1 has joined #ruby
roshanavand has quit [Ping timeout: 247 seconds]
roshanavand1 is now known as roshanavand
<insomniac_>
Hi everybody, I need some help with getting ':' in rb_scan_args working. Here is what I have so far: https://pastebin.com/faXRqXJG ; I was under the impression, that "11*:" should be equal to `def foo server, host, *others, *hash` but it seems not
<ruby[bot]>
insomniac_: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
frozengeek has quit [Quit: frozengeek]
frozengeek has joined #ruby
Azure has quit [Quit: Oops.]
Azure has joined #ruby
<catphish>
dminuoso: thanks, i thought BigDecimal stored exact decimal values, not like a float :(
adlerdias has joined #ruby
vondruch has quit [Client Quit]
<dminuoso>
catphish: float kind of does store exact decimals, but in a representation that is more efficient to calculate with
vondruch has joined #ruby
<catphish>
i'll have a closer look at all 3, thanks
Azure has quit [Client Quit]
quiqua has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
catphish: For the purpose of this discussion, assume BigDecimal to be just a IEEE 754 float, except the precision is unbounded
Azure has joined #ruby
quiqua has joined #ruby
<catphish>
the reason for my question is that i want a ruby Numeric that most closely approximates the format in a documented protocol, which consists of 2 intergers, "value" and "scale"
<dminuoso>
Or in other words: there's no limit on the bits for the significand and the exponent.
<dminuoso>
catphish: rational
enterprisey has joined #ruby
<dminuoso>
Or.. mmm. Turns out BigDecimal defaults to base 10
<catphish>
"Significand" is word i needed
<catphish>
i thought float had base2 exponents
enterprisey has quit [Client Quit]
<catphish>
and decimal has base10
<dminuoso>
catphish: or base 10, IEEE 754 places no immediate restriction on it
<catphish>
oh ok
<dminuoso>
Naturally they just use base 2 because its tons faster to operate on for a processor
<dminuoso>
catphish: So if BigDecimal uses base 10 its a good fit after all.
<dminuoso>
Question is just whether you need to calculate with it
milardovich has joined #ruby
<catphish>
i'm really just looking for a way to efficiently exchange decimal numbers between ruby and this protocol format
<catphish>
i am assuming the exponent in the protocol is base 10, though i haven't confirmed this
selim has quit [Ping timeout: 240 seconds]
selim has joined #ruby
beilabs has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
milardovich has quit [Ping timeout: 240 seconds]
f48ds2 has joined #ruby
beilabs has quit [Remote host closed the connection]
xall has quit [Ping timeout: 240 seconds]
beilabs has joined #ruby
insomniac_ has quit [Quit: Page closed]
vondruch has quit [Quit: vondruch]
ur5us has quit [Remote host closed the connection]
vondruch has joined #ruby
roshanavand has quit [Ping timeout: 240 seconds]
xall has joined #ruby
ur5us has joined #ruby
ur5us has quit [Remote host closed the connection]
astrobunny has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
astrobunny has joined #ruby
astrobunny has quit [Read error: Connection reset by peer]
vondruch has joined #ruby
beilabs has quit [Remote host closed the connection]
nacsurte has joined #ruby
beilabs has joined #ruby
hightower2 has joined #ruby
beilabs has quit [Remote host closed the connection]
beilabs has joined #ruby
nacsurte has quit [Ping timeout: 255 seconds]
rgr has joined #ruby
runescape07rsps has joined #ruby
yaewa has quit [Quit: Leaving...]
moei has joined #ruby
sepp2k has joined #ruby
<rgr>
I enter rvm use 2.3.3@vollfilm and rvm replies that its using it. I type "rvm use" and it says its using a different ruby version. What gives? Help. Totally confused.
belmoussaoui_ has joined #ruby
<dminuoso>
rgr: Any particular reason you use rvm?
bruno- has joined #ruby
<rgr>
because just about every single place I have visisted say its the best way to manage ruby versions. I am new to ruby and have inherited a legacy system. Anyway. do you know what the problem might be?
<rgr>
or why I should not use it?
christoph has joined #ruby
<dminuoso>
rgr: It's not. RVM is complex and usually leads to issues when you dont understand what it does.
<dminuoso>
If you are new to ruby, ditch RVM right now and just use ruby-install + chruby if you really need multiple versions of ruby.
<christoph>
hi, can anyone help me installing travis
<ruby[bot]>
christoph: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
phatypus has quit [Quit: phatypus]
<rgr>
i shall look into it. thanks.
vondruch has quit [Quit: vondruch]
<dminuoso>
rgr: note you probably dont even need multiple versions, so just ruby-install to get a recent version is enough.
vondruch has joined #ruby
trinket has quit [Ping timeout: 240 seconds]
<dminuoso>
christoph: Make sure you install the development package for ruby through your package management system, something like ruby-dev
<christoph>
ahh okay, thanks i will try never developed via ruby
<rgr>
I do. Its a legacy system and hasnt been touched for 7 years or something.
<rgr>
thanks.
beilabs has quit [Remote host closed the connection]
jameser has joined #ruby
<dminuoso>
christoph: When compiling native extensions you require the ruby header your ruby was built with. Many systems keep "a package" and "the headers from the source it was built with" in separate packages.
<christoph>
yes this works perfectly fine
<christoph>
thanks a lot
bronson has joined #ruby
ldnunes has joined #ruby
cabotto has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
rlanglang has joined #ruby
<rlanglang>
hi
bronson has quit [Ping timeout: 240 seconds]
gigetoo has joined #ruby
rlanglang has quit [Ping timeout: 260 seconds]
astrobunny has joined #ruby
<catphish>
nice work ruby[bot] :)
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
bmurt has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
cabotto has left #ruby [#ruby]
bmurt has quit [Client Quit]
nacsurte has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
synthroid has joined #ruby
nacsurte has quit [Ping timeout: 246 seconds]
hinbody has joined #ruby
astrobunny has quit [Remote host closed the connection]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has quit [Client Quit]
FernandoBasso has joined #ruby
vondruch has joined #ruby
raynold has quit [Quit: Connection closed for inactivity]
synthroi_ has joined #ruby
synthroid has quit [Ping timeout: 240 seconds]
rapha has quit [Quit: WeeChat 1.8-dev]
bmurt has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
uZiel has joined #ruby
Daneel has joined #ruby
NeverTired has quit [Quit: Connection closed for inactivity]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
rgr has quit [Remote host closed the connection]
jameser has joined #ruby
jameser has quit [Client Quit]
synthroid has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
synthroi_ has quit [Ping timeout: 255 seconds]
DTZUZO_ has joined #ruby
vondruch has quit [Quit: vondruch]
Burgestrand has quit [Read error: Connection reset by peer]
vondruch has joined #ruby
Burgestrand has joined #ruby
rgr has joined #ruby
jameser has joined #ruby
adlerdias_ has joined #ruby
xall has quit [Ping timeout: 255 seconds]
<rgr>
moving to chruby is a nightmare. It simpy doesnt work following the instructions. ruby-install not found. Aaargh.
ldnunes has quit [Ping timeout: 240 seconds]
kapil___ has joined #ruby
adlerdias has quit [Ping timeout: 240 seconds]
adlerdias_ is now known as adlerdias
vondruch has quit [Quit: vondruch]
milardovich has joined #ruby
vondruch has joined #ruby
nacsurte has joined #ruby
aupadhye has quit [Ping timeout: 248 seconds]
vondruch has quit [Client Quit]
vondruch has joined #ruby
Xiti has quit [Quit: Xiti]
Xiti has joined #ruby
t-recx has joined #ruby
nacsurte has quit [Ping timeout: 240 seconds]
ecuanaso has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Polymorphism has joined #ruby
Terens has quit []
ldnunes has joined #ruby
jameser has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
<rgr>
that covered. not I ruby-install 2.3.3 and... chruby doesnt know about it. What is this? RVM is really out the window and I should use this?
rgr has quit [Quit: rgr]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
chouhoulis has joined #ruby
milardovich has quit []
rabajaj has quit [Quit: Leaving]
runescape07rsps has quit [Quit: Leaving]
vondruch has quit [Client Quit]
vondruch has joined #ruby
belmoussaoui_ has quit [Quit: belmoussaoui_]
belmoussaoui_ has joined #ruby
chouhoulis has quit [Remote host closed the connection]
hightower2 has quit [Read error: Connection reset by peer]
belmoussaoui_ has quit [Quit: belmoussaoui_]
belmoussaoui_ has joined #ruby
theunraveler has joined #ruby
uZiel has quit [Ping timeout: 268 seconds]
Burgestrand has quit [Quit: Good bye and have a nice day!]
Burgestrand has joined #ruby
oleo has joined #ruby
uZiel has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tvw has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
elnner has quit [Read error: Connection reset by peer]
bronson has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
dymaxion_ has joined #ruby
synthroid has quit [Remote host closed the connection]
synthroid has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
dymaxion_ has quit [Ping timeout: 240 seconds]
ana_ has quit [Quit: Leaving]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
synthroid has quit [Ping timeout: 255 seconds]
anisha has quit [Quit: This computer has gone to sleep]
vondruch has quit [Client Quit]
vondruch has joined #ruby
uZiel has quit [Ping timeout: 268 seconds]
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cdg has joined #ruby
beilabs has joined #ruby
f48ds2 has quit [Quit: WeeChat 1.9]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Rapture has joined #ruby
porfa has joined #ruby
chouhoulis has joined #ruby
beilabs has quit [Read error: Connection reset by peer]
mgorbach has quit [Remote host closed the connection]
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mgorbach has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
chouhoul_ has joined #ruby
govg has quit [Ping timeout: 240 seconds]
uZiel has joined #ruby
chouhoulis has quit [Ping timeout: 255 seconds]
jinie has quit [Read error: Connection reset by peer]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
bruno- has quit [Ping timeout: 240 seconds]
jinie has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
beilabs_ has joined #ruby
beilabs__ has joined #ruby
sleepee has joined #ruby
beilabs_ has quit [Read error: No route to host]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
ResidentBiscuit has quit [Read error: Connection reset by peer]
<cjohnson>
Can somebody explain to me why rubocop thinks using -> (foo) { \n multi-line \n body \n here \n } is bad?
<cjohnson>
But using lambda keyword is fine
<cjohnson>
What's the logic there?
adlerdias_ has joined #ruby
<matthewd>
cjohnson: Doesn't rubocop explain why it thinks that?
<purple_apple>
cjohnson: no idea what the reason is, but whatever it is, it's not valid.
synthroid has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
<cjohnson>
Use the lambda method for multiline lambdas.
<cjohnson>
is the reason
<purple_apple>
right. so it's a subjective opinion.
<purple_apple>
but these things are configurable, no?
<cjohnson>
Yeah but I asked coworkers about disabling that rule, because it seems silly to me as well, but they all said "multiline arrow functions seem confusing"
<cjohnson>
couldn't really tell me more than that
adlerdias has quit [Ping timeout: 248 seconds]
adlerdias_ is now known as adlerdias
<matthewd>
[Almost] all of rubocop's ruleset is subjective opinion
<purple_apple>
syntax is a little confusing
<cjohnson>
I am not a ruby dev by nature so just curious if others can tell me a better reasoning
<cjohnson>
maybe something historical
<cjohnson>
In JS that would be perfectly natural
<purple_apple>
no, not really.
<purple_apple>
just one guy's opinion
<matthewd>
do/end is more common for multi-line blocks
<purple_apple>
But using lambda keyword is fine
<purple_apple>
i don't think thats relevant
beilabs__ has quit [Remote host closed the connection]
<matthewd>
I disagree with a lot of rubocop's default rules, but do agree that arrow spelling feels odd
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
frozengeek has quit [Quit: frozengeek]
cbyrda has joined #ruby
frozengeek has joined #ruby
<purple_apple>
i disagree with most overly nitpick-y style nazi's.
<purple_apple>
but, the shorthand syntax is a little confusing. ignoring it doesn't help you learn it though.
bruno- has joined #ruby
uZiel has quit [Ping timeout: 268 seconds]
lubekpl has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
laphoriag75 has quit [Ping timeout: 246 seconds]
pootiscoder has quit [Quit: Going offline, see ya! (www.adiirc.com)]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
kculpis has quit [Quit: Leaving]
<jokke>
how can i "break out of the current bundle"?
mark_66 has quit [Remote host closed the connection]
<purple_apple>
i guess that's one way gofmt and rubocop are very different. Go wouldn't add syntax to the language that it doesn't approve of, and gofmt is developed by a team who work together with language creators.
cschneid_ has joined #ruby
<matthewd>
jokke: Not easily
<purple_apple>
@jokke yeah thought about this the other day as well. did you try `m = Kernel.method(:require); require 'bundler/require'; m.call("foo")`.
<jokke>
hm
<jokke>
i call rake install (from bundlers gem tasks), which needs the bundle but has to be able to run gem install (for git gem deps) system wide
<purple_apple>
bundler/setup*
<purple_apple>
i don't know. sounds like a problem you can solve by being careful when you require 'bundler/setup'.
vondruch has quit [Client Quit]
<jokke>
i don't actually require it but i guess bundle exec does that already
vondruch has joined #ruby
<purple_apple>
yea
<purple_apple>
it does
<jokke>
so there's no Bundle.without_bundle do .. end :)
<purple_apple>
oh
<purple_apple>
Bundler.with_clean_env {}
<jokke>
oh! lol :D
<purple_apple>
could try that
<jokke>
nice thanks
<jokke>
i'll give it a go
<cjohnson>
purple_apple: My question was specifically about using -> with multi-lines. rubocop wants you to use the lambda keyword
<cjohnson>
just to clarify
SqREL has quit [Remote host closed the connection]
<purple_apple>
i know. i understood that. i only said "do/end is more common for multi-line blocks" is irrelevant because it's not part of the rule rubocop is applying here.
<cjohnson>
Gotchya
polishdub has joined #ruby
<dminuoso>
purple_apple, btw the entire default setting of rubocop is just subjective opinion
aglorei1 has quit [Ping timeout: 268 seconds]
SqREL has joined #ruby
<purple_apple>
yeah. i like the idea. but adoption and development by something more official would be nice.
nacsurte has joined #ruby
<purple_apple>
pretty sure matz was okay adding ()-> {} syntax to the language for example
pootiscoder has joined #ruby
SqREL has quit [Ping timeout: 240 seconds]
futilegames has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
funkytwig has joined #ruby
Burgestrand has quit [Quit: Closing time!]
rwb has quit [Ping timeout: 248 seconds]
armando has joined #ruby
sleepee has quit [Ping timeout: 255 seconds]
aglorei1 has joined #ruby
<dminuoso>
purple_apple, no because it'd be grammatically ambiguous
<purple_apple>
tbh ()->{} vs lambda{} falls into the area of "i dont care" for me, so if there's an auto-transform to fix it everywhere without me doing a thing, great if i have to do it manually, and it's failing builds, no thx
<purple_apple>
?
<dminuoso>
purple_apple, think: puts (a) -> {}
<purple_apple>
yes, how do is: puts lambda{|a|} different?
<dminuoso>
purple_apple, lambda is a keyword
<dminuoso>
that's how
<purple_apple>
no it's not
<purple_apple>
it's a method
<dminuoso>
Oh. Well that then.
<dminuoso>
purple_apple, the point is, puts (a) -> {} would be impossible to differentiate whether (a) was parens to puts or not
<dminuoso>
and the only reason is puts (a) is legal syntax.
quobo has quit [Quit: Connection closed for inactivity]
<purple_apple>
i'm not getting into another one of these discussions with you, sorry. one a week is enough.
bmurt has joined #ruby
aufi has quit [Quit: Leaving]
pootiscoder has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
uZiel has joined #ruby
vondruch has joined #ruby
govg has joined #ruby
pootiscoder has joined #ruby
ResidentBiscuit has joined #ruby
nobitanobi has joined #ruby
h1res has joined #ruby
TomyWork has quit [Remote host closed the connection]
Subfusc has left #ruby ["Konversation terminated!"]
h1res has left #ruby [#ruby]
ferr has quit [Quit: WeeChat 1.9]
futilegames has quit [Quit: futilegames]
futilegames has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
porfa has quit [Quit: porfa]
sepp2k has quit [Quit: Leaving.]
astrobunny has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
porfa has joined #ruby
enterprisey has joined #ruby
porfa has quit [Client Quit]
enterprisey has quit [Remote host closed the connection]
eightlimbed has joined #ruby
porfa has joined #ruby
porfa has quit [Client Quit]
porfa has joined #ruby
porfa has quit [Client Quit]
porfa has joined #ruby
brent__ has joined #ruby
Sembei has joined #ruby
raynold has joined #ruby
Pisuke has quit [Ping timeout: 260 seconds]
mark_on_the_moon has joined #ruby
belmoussaoui_ has quit [Remote host closed the connection]
porfa has quit [Ping timeout: 240 seconds]
tvw has joined #ruby
DTZUZO_ is now known as DTZUZO
Cork has quit [Quit: .]
Cork has joined #ruby
nowhere_man has joined #ruby
bronson has joined #ruby
sepp2k has joined #ruby
sepp2k has quit [Client Quit]
dionysus69 has joined #ruby
TomyLobo has joined #ruby
synthroi_ has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jnollette has quit [Quit: All your IRC are belong to ZNC]
mikecmpbll has quit [Quit: inabit. zz.]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
jnollette has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
polishdub has joined #ruby
jnollette has quit [Client Quit]
weaksauce has quit [Read error: Connection reset by peer]
Serpent7776 has quit [Quit: Leaving]
MyMind has joined #ruby
sepp2k has joined #ruby
mark_on_the_moon has quit [Changing host]
mark_on_the_moon has joined #ruby
jnollette has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Sembei has quit [Ping timeout: 240 seconds]
mgorbach has quit [Remote host closed the connection]
gusrub has joined #ruby
Pisuke has joined #ruby
mgorbach has joined #ruby
jwarren_ has joined #ruby
MyMind has quit [Ping timeout: 248 seconds]
futilegames has quit [Quit: futilegames]
S007 has quit [Ping timeout: 255 seconds]
frozengeek has quit [Quit: frozengeek]
frozengeek has joined #ruby
frozengeek has quit [Client Quit]
frozengeek has joined #ruby
beilabs_ has joined #ruby
synthroi_ has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
synthroid has joined #ruby
synthroi_ has joined #ruby
cadillac_ has quit [Ping timeout: 240 seconds]
cadillac_ has joined #ruby
majuk has joined #ruby
belmoussaoui has joined #ruby
beilabs_ has quit [Ping timeout: 240 seconds]
synthroid has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
weaksauce has joined #ruby
S007 has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
beilabs_ has joined #ruby
<majuk>
Hey guys. I have an array with 5 elements. I need to ensure elements 1-3 match a pattern [so not 0 or 4]. I see there's Array.each. Can I modify that to only consider a specific range?
uZiel has quit [Remote host closed the connection]
beilabs_ has quit [Read error: Connection reset by peer]
beilabs_ has joined #ruby
jwarren_ has quit []
<purple_apple>
arr[1..3].each {|x| }
<majuk>
purple_apple: lol, yep, I just found that myself. Thanks.
<purple_apple>
but probably, you want something like: arr[1..3].all? {|x| x =~ /pattern/}.
pandaant has quit [Remote host closed the connection]
<majuk>
purple_apple: would {|x| x.chomp =~ /pattern/} be valid?
<majuk>
I need that chomp
<apeiros>
your block can contain any code
<purple_apple>
`arr[1..3].all? {|x| x.chomp =~ /pattern/}` is valid, yeah. you can do anything you want in the block.
<apeiros>
so yes, though I wonder why you don't attribute for it in the regex instead
<majuk>
Cool, thanks.
* clemens3
should check the all? api
<majuk>
This is like day 2 writing ruby, not very confident with any of this.
uZiel has joined #ruby
belmoussaoui__ has joined #ruby
alfiemax has joined #ruby
belmoussaoui has quit [Ping timeout: 240 seconds]
<purple_apple>
ah well. ruby is very flexible. code can be executed anywhere, including in module and class bodies, as their they're defined.
<purple_apple>
-their
belmoussaoui__ is now known as belmoussaoui
<purple_apple>
usually not many restrictions on what the language will let you do, compared to other languages
<majuk>
That flexibility in structure is probably nice for more experienced people. Only serves to confuse me.
<majuk>
Anyhow, thanks.
gusrub has quit [Remote host closed the connection]
<purple_apple>
well. you could learn Java first, to learn why being rigid only serves to be annoying most the time.
runescape07rsps has joined #ruby
gusrub has joined #ruby
Beams has quit [Quit: .]
<majuk>
I'm saying that writing something that would take me 15 lines, condensing it to 1 line makes it impossible for me to tell wtf I'm doing and address problems.
<apeiros>
I'm not sure I understand correctly what you're trying to say
<majuk>
Nothing of substance.
<purple_apple>
right, yeah. so maybe learn how Enumerable in Ruby works, and the one-liner should be easier to understand.
<apeiros>
are you saying that the 15 lines would be more comprehensible than the 1 line?
S007 has quit [Ping timeout: 255 seconds]
bigkevmcd has quit [Quit: Outta here...]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
<majuk>
purple_apple: Cool, I'll google that. Thanks.
<purple_apple>
but yeah. google it. higher-level docs are probably better
<matthewd>
I'd argue it's often not flexibility, but consistency: most things are Just An Expression, so they're equally interchangeable
synthroi_ has quit []
<purple_apple>
yeah, true too
gusrub has quit [Remote host closed the connection]
<matthewd>
Which leads to flexibility, of course... but it's not that you have to learn NxM unique combinations -- you're just learning one set of N concepts, then combining them in ways that make sense once you understand them individually
vondruch has quit [Client Quit]
vondruch has joined #ruby
gusrub has joined #ruby
anisha has joined #ruby
<catphish>
yay, my infinite loops have gone away with my patch :)
<catphish>
at least so far
AndBobsYourUncle has joined #ruby
AndBobsYourUncle has quit [Client Quit]
AndBobsYourUncle has joined #ruby
eckhardt has joined #ruby
AndBobsYourUncle has quit [Client Quit]
eightlimbed has quit [Ping timeout: 264 seconds]
rrod_error has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
AndBobsYourUncle has joined #ruby
<purple_apple>
∞🔫
mikecmpbll has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
Dark_Arc has quit [Ping timeout: 260 seconds]
psmolen has quit [Ping timeout: 260 seconds]
\13k has quit [Ping timeout: 260 seconds]
mr_rich101 has quit [Ping timeout: 260 seconds]
psmolen has joined #ruby
sepp2k has quit [Quit: Leaving.]
S007 has joined #ruby
mr_rich101 has joined #ruby
\13k has joined #ruby
Dark_Arc has joined #ruby
ecuanaso has joined #ruby
frozengeek has quit [Ping timeout: 240 seconds]
uZiel has quit [Ping timeout: 268 seconds]
FernandoBasso has quit [Quit: Leaving]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
uZiel has joined #ruby
SeepingN has joined #ruby
christoph has quit [Ping timeout: 240 seconds]
nOwz has joined #ruby
n0wz has quit [Ping timeout: 246 seconds]
dviola has joined #ruby
vondruch has quit [Quit: vondruch]
hahuang61 has quit [Ping timeout: 248 seconds]
S007 has quit [Quit: Quit]
vondruch has joined #ruby
nOwz has quit [Ping timeout: 255 seconds]
nickjj has joined #ruby
majuk has quit [Remote host closed the connection]
rrod_error has quit [Ping timeout: 246 seconds]
bronson has joined #ruby
nOwz has joined #ruby
belmoussaoui has quit [Quit: belmoussaoui]
belmoussaoui_ has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
dviola has quit [Quit: WeeChat 1.9]
bronson has quit [Ping timeout: 248 seconds]
belmoussaoui_ has quit [Quit: belmoussaoui_]
ResidentBiscuit has quit [Ping timeout: 248 seconds]
belmoussaoui has joined #ruby
vondruch has quit [Client Quit]
christoph has joined #ruby
vondruch has joined #ruby
dyjakan has joined #ruby
ResidentBiscuit has joined #ruby
chouhoul_ has quit [Remote host closed the connection]
dyjakan has left #ruby [#ruby]
belmoussaoui has quit [Ping timeout: 255 seconds]
chouhoulis has joined #ruby
jackjackdripper has joined #ruby
NeverTired has joined #ruby
QualityAddict has quit [Ping timeout: 240 seconds]
QualityAddict has joined #ruby
belmoussaoui has joined #ruby
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
belmoussaoui has quit [Client Quit]
nowhere_man has quit [Ping timeout: 276 seconds]
belmoussaoui has joined #ruby
rrod_error has joined #ruby
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
belmoussaoui has quit [Quit: belmoussaoui]
cdg has quit [Remote host closed the connection]
Dimik has joined #ruby
QualityAddict has quit [Remote host closed the connection]
rrod_error has quit [Ping timeout: 240 seconds]
QualityAddict has joined #ruby
belmoussaoui has joined #ruby
nobitanobi has quit [Ping timeout: 255 seconds]
ResidentBiscuit has quit [Read error: Connection reset by peer]
nobitanobi has joined #ruby
anisha has quit [Quit: This computer has gone to sleep]
ResidentBiscuit has joined #ruby
<dminuoso>
catphish, is your solution rb_daemon safe?
<dminuoso>
catphish, its not -> it now has the potential to hang a Process.daemon daemonized process.
vondruch has quit [Client Quit]
laphoraig92 has quit [Remote host closed the connection]
vondruch has joined #ruby
<dminuoso>
catphish, fixing bugs in Ruby is like playing Kal-toh.
<catphish>
what does daemon() do?
<dminuoso>
catphish, it's a way of detaching a process from the process it runs in.
<catphish>
oh, its a kernel function
<dminuoso>
catphish, yeah. And before ruby invokes it, it acts as if its going to fork.
<dminuoso>
so suddenly the main process is running all the fork handlers
<John__>
Hi, sorry for asking this and I know I'm "probably" gonna get some biased answers for being in the ruby channel but - between Ruby and Python (rubyOnrails and Django respectively), which one tends to have a better documentation overall that takes you nicely through the entire development process, including tackling of difficult webdev problems?
<catphish>
wonder if threads come with it
<dminuoso>
catphish, they do.
<dminuoso>
catphish, the original process remains the same.
<dminuoso>
kind of
<eam>
I'd be surprised if daemon() works with threads
<eam>
one of the things it needs to do is perform a double-fork
<eam>
generally, you need to call that at the very start of your program
jaruga has quit [Quit: jaruga]
<dminuoso>
eam, mmm.
<catphish>
i don't really understand the difference between daemon and fork
<dminuoso>
Well either way, you have to make sure that rb_daemon does _not_ cause that timer reset
WebDawg is now known as neoweb
<eam>
daemon() isn't a kernel function per se, it's a set of steps which attempts to detatch a process from the current session
<catphish>
not if the parents exits and the child has no threads
rrod_error has quit [Ping timeout: 240 seconds]
<eam>
elements of that include: double fork to reset parent to init, close descriptors, cd somewhere safe, call setsid to become session leader
<dminuoso>
catphish, semantically daemon detaches the current process.
<dminuoso>
catphish, fork creates a new additional one
rwb has joined #ruby
<catphish>
from what i can see, daemon runs fork, then exits the parent
<catphish>
but i'm not certain
<dminuoso>
catphish, yes. But it runs rb_thread_atfork before it forks.
lxsameer has joined #ruby
<dminuoso>
Which means this could run between the inc/dec slice again
lxsameer is now known as Guest10613
alfiemax has quit [Remote host closed the connection]
Guest10613 has quit [Client Quit]
alfiemax has joined #ruby
sameerynho has joined #ruby
<catphish>
no it doesn't, it runs it after it forks
alfiemax has quit [Remote host closed the connection]
dlitvak has quit [Quit: Connection closed for inactivity]
vondruch has quit [Quit: vondruch]
<catphish>
this assumes that daemon exits the parent immediately (i think it does)
vondruch has joined #ruby
conta3 has joined #ruby
konsolebox has quit [Ping timeout: 240 seconds]
<dminuoso>
catphish, bah this is why Im starting with functional programming.
<catphish>
one more thing... i did not use rb_thread_atfork() i used gvl_atfork()
<dminuoso>
This myriad of maintaining global mutable state is just... woah.
<catphish>
i'm not sure why
<catphish>
ugh, global mutable state, my least favourite words this week
<dminuoso>
catphish, do you know how many state-related bugs my redux/react has had over the past 6 months?
vuoto has quit [Remote host closed the connection]
<dminuoso>
With bizarre race conditions that occured only sometimes?
<catphish>
oh, there's no native_atfork
<catphish>
i've actually stopped using threads in all new code
<catphish>
all my apps are not event driven
<catphish>
*now
<dminuoso>
catphish, threads are not the issue.
<dminuoso>
mutable state is
<dminuoso>
:P
conta3 has quit [Ping timeout: 240 seconds]
vondruch has quit [Client Quit]
vondruch has joined #ruby
<catphish>
this is also the reason i'm wasting several says writing a new AMQP client
rrod_error has joined #ruby
konsolebox has joined #ruby
hanmac has joined #ruby
ams__ has quit [Quit: Connection closed for inactivity]
sagax has joined #ruby
<eam>
I mean, threads are mutable state
<eam>
the whole reason I mentioned daemon() above is that the thread state isn't copied across fork()
hsiktas has quit []
hsiktas has joined #ruby
eightlimbed has joined #ruby
gusrub has quit [Remote host closed the connection]
<dminuoso>
eam, not necessarily. You can have threads without mutable global state, the fact they share the same address space is also an optimization because of reduced TLB pressure
<catphish>
did we ascertain whether threads are coped across daemon?
<eam>
catphish: they are not
<catphish>
good :)
<catphish>
i'm ok with my patch then
runescape07rsps has quit [Read error: Connection reset by peer]
<eam>
dminuoso: yes necessarily. A thread, at its core, is a supplementary stack and execution context -- mutable state by definition in both cases
<catphish>
even if its a hack, it's working for me in production now
<dminuoso>
eam, ah I see what you mean
<eam>
I agree, you can treat the heap as immutable though!
<dminuoso>
eam, well I was talking about global mutable state across threads rather.
<eam>
yeah, I agree WRT software design; I'm kinda talking about the systems ramifications of threads in the unix process model
eckhardt has joined #ruby
jamesaxl has quit [Quit: WeeChat 1.8]
hahuang61 has quit [Ping timeout: 240 seconds]
opekktar has joined #ruby
<catphish>
i do quite like pthreads, but avoid when whenever humanly possible these days
eightlimbed has quit [Ping timeout: 264 seconds]
majuk has quit [Remote host closed the connection]
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rapture has joined #ruby
roshanavand has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
brent__ has quit [Remote host closed the connection]
Qommand0r has joined #ruby
beilabs_ has quit [Remote host closed the connection]
brent__ has joined #ruby
lilpolzin has left #ruby ["Leaving"]
bladdezz has joined #ruby
belmoussaoui__ has joined #ruby
belmoussaoui has quit [Ping timeout: 246 seconds]
belmoussaoui__ is now known as belmoussaoui
brent__ has quit [Ping timeout: 240 seconds]
rwb has quit [Ping timeout: 240 seconds]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
belmoussaoui has quit [Quit: belmoussaoui]
belmoussaoui has joined #ruby
theunraveler has quit []
dionysus69 has quit [Ping timeout: 240 seconds]
Alina-malina has quit [Ping timeout: 260 seconds]
jinie has quit [Ping timeout: 248 seconds]
Alina-malina has joined #ruby
belmoussaoui has quit [Quit: belmoussaoui]
uZiel has quit [Ping timeout: 268 seconds]
belmoussaoui has joined #ruby
cadillac_ has quit [Quit: I quit]
alex`` has quit [Quit: WeeChat 1.9]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
cadillac_ has joined #ruby
belmoussaoui has quit [Ping timeout: 255 seconds]
workmad3 has quit [Ping timeout: 255 seconds]
username1 has joined #ruby
ShekharReddy has quit [Quit: Connection closed for inactivity]
vondruch has quit [Client Quit]
vondruch has joined #ruby
alex`` has joined #ruby
eckhardt has joined #ruby
nopolitica has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
frozengeek has quit [Quit: frozengeek]
roshanavand has quit [Ping timeout: 240 seconds]
hahuang61 has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
ldnunes has quit [Quit: Leaving]
funkytwig has joined #ruby
<funkytwig>
Hi. I have a a question whitch I thnik will be considered opinion (its a kind of best practice question) so probably best not to ask it on stack overflow.
<funkytwig>
But only other good ruby comunity resorce I know is here.
hahuang61 has quit [Ping timeout: 240 seconds]
<funkytwig>
but its probably a bit involved to ask here, is there any ware else I can go?
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
belmoussaoui_ has joined #ruby
dstrunk has joined #ruby
<purple_apple>
ruby-forum.com
<havenwood>
funkytwig: ask us!
<havenwood>
funkytwig: Use a gist if it's a wall of text.
<havenwood>
?gist
<ruby[bot]>
https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
vondruch has quit [Client Quit]
vondruch has joined #ruby
<funkytwig>
Thanks, will do.
nopolitica has joined #ruby
<funkytwig>
pasted it into guist, quess I have to put in hard returns as its not wrapping.
ForeignBiscuit has joined #ruby
<funkytwig>
pants, cant work out how to edit the gist
rrod_error has quit [Quit: leaving]
<havenwood>
funkytwig: Gists are editable if you're logged in to the Githubs.
ResidentBiscuit has quit [Ping timeout: 240 seconds]
<purple_apple>
> (or can I call them .class, is this wrong).
<purple_apple>
yes, it's wrong, in the sense that no editor understands it as ruby, or people generally. require will not be able to load it. you'd have to use Kernel#load. so there's a strong argument for using `.rb`.
<purple_apple>
> So now I have (at least) two options in terms of including the classes, I can either have a script (called something
<purple_apple>
yeah. puddle_setup.rb sounds fine. but adding lib/mylib.rb, lib/mylib/class.rb, lib/mylib/someotherclass.rb is more standard, where 'mylib.rb' requires everything
<purple_apple>
need all the classes (which does not seem elegant). Will using puddle_setup.rb work and be sensible?.
<purple_apple>
like puddle_setup.rb) which requires all the classes (and 'pry') or have a set of requires in each of the scripts whitch
AndBobsYourUncle has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<purple_apple>
usually filenames map to class names, so class.rb could be something else, unless you're monkey patching Class but i don't think you are.
phinxy has joined #ruby
<purple_apple>
lib/masterclass.rb, lib/one.rb, lib/two.rb, lib/mylib.rb. "mylib" requires masterclass.rb first, then one, then two, so all dependencies are met, and each class has its own file.
phinxy has quit [Max SendQ exceeded]
AndBobsYourUncle has joined #ruby
<funkytwig>
OK, I I should call the directory with the classes lib not class?
<purple_apple>
yeah. lib is standard in ruby. a gem has that structure: lib/ directory, and optional bin/ directory for executable scripts you run at cmd line.
<purple_apple>
but can structure however you want. lib/ will be more familiar to other ruby developers
ltem has quit [Quit: Leaving]
<funkytwig>
OK, so the only other thing is if the main scripts are in top directory wil lthe require for masterclass.rb be lib/msdterclass.rb or just masterclass.rb as the file I am including is already in the lib directory.
<funkytwig>
Think you answered it by just checking.
Cohedrin_ has joined #ruby
<purple_apple>
yeah, lib is normally added to $LOAD_PATH, so `lib` can be omitted. require 'masterclass' is enough.
<funkytwig>
Lastly on git do I just add the new files and rm the old ones, I guess there is no clever way of tracking changes pre and post restructure.
* funkytwig
poping out as chop just about to close, back in 5
<purple_apple>
in bin/myscript, you could have: require_relative "../lib/mylib" (which requires everything), or, $LOAD_PATH.push("../lib"), or... gemify the project. id go with the one of the first two for now
sleepee has joined #ruby
<purple_apple>
ruby -Ilib bin/myscript
<purple_apple>
other option
phinxy has joined #ruby
phinxy has quit [Max SendQ exceeded]
<elomatreb>
git understands renames, `git mv oldpath newpath`, if that's what you mean
<purple_apple>
only other recommended thing to do is put 'masterclass.rb', 'one.rb', 'two.rb', etc, in lib/mylib/ directory, with lib/mylib.rb as the entry point that requires everything. it'll give you a namespace so you can choose common names like 'one.rb', or 'class.rb', without worrying that something else will be required instead.
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
cdg has quit [Remote host closed the connection]
<elomatreb>
Of course you still need to wrap things in modules, there's no auto namespace or something like that
<purple_apple>
right, good point
<elomatreb>
But if you want those sub-files to be requirable it's still good to avoid collisions, e.g. if your gem offers a rake_task.rb
ForeignBiscuit has quit [Read error: Connection reset by peer]
Alina-malina has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
SqREL has joined #ruby
phinxy has joined #ruby
<funkytwig>
so I create lib/puddle and put everything in there and require 'puddle' would load everything in the /lib/puddle directory.
christoph has quit [Remote host closed the connection]
brent__ has quit [Remote host closed the connection]
brent__ has joined #ruby
phinxy has left #ruby [#ruby]
SqREL has quit [Ping timeout: 255 seconds]
<funkytwig>
but do I then refer to the class as puddle.Classname
<purple_apple>
right. lib/puddle and lib/puddle.rb to require everything in lib/puddle.
<purple_apple>
lib/puddle.rb should have: module Puddle; end
<purple_apple>
then require_relative "puddle/one" will have: class Puddle::One; end.
Tharbakim has quit [Quit: Something has gone terribly wrong. Send help.]
<purple_apple>
then Puddle::One.new etc.
<funkytwig>
ok, what does module do
<funkytwig>
hand on, ile look it up
<purple_apple>
it creates a module that acts as a namespace for all your classes.
<havenwood>
funkytwig: A module is for when you have no internal state. A class with Singleton is when you have one instance of state. A class is for multiple instances of state.
<purple_apple>
it could be, 'class Puddle; end' too but that's less common if `Puddle.new` is not used.
<purple_apple>
class names and module names should map to the filename and directory structure of lib/, so lib/foo/bar/baz.rb should map to Foo::Bar::Baz.
<funkytwig>
Sowith modues it seems we go back to having multiple classes within a file?
<elomatreb>
I'd say don't worry about all but the first, they only appear in very specific circumstances
<elomatreb>
No, you can split them across as many files as you like, since you can always re-open/change a class or module in Ruby
<purple_apple>
that should be plenty to get you going
Methos has joined #ruby
futilegames has joined #ruby
futilegames has quit [Client Quit]
TomyLobo has quit [Ping timeout: 255 seconds]
Methos is now known as Guest98617
<elomatreb>
Specifying the module name in the class is sometimes frowned upon, as it requires that all your files are loaded after the file that creates the module, otherwise you will get an undefined module error
<elomatreb>
You can alternatively do `module A \n class B; end; end` as well, but that can end in many levels of indentation that aren't really necessary
<purple_apple>
yes, but that's subjective thing there are arguments for and against.
<funkytwig>
OK, I actualy have a class called Puddle, its what I caled the master class
<purple_apple>
i think we're far away from learning how constant lookup works in ruby
Guest98617 is now known as GGMethos
<funkytwig>
and do I need to change any or by code to use the namespace
ur5us has quit [Remote host closed the connection]
<purple_apple>
i can't help anymore than that. start trying to adapt this to your project.
<purple_apple>
Line 5 should be: require_relative "puddle/puddle" now.
chouhoulis has quit [Ping timeout: 248 seconds]
<purple_apple>
you said you're using git. so create a new branch, and experiment. no doubt you'll face further challenges that might take a while to figure out.
chouhoul_ has quit [Ping timeout: 240 seconds]
<funkytwig>
purple_apple, thanks, hopefully ime not over engenering stuff stuff;)
astrobunny has quit [Remote host closed the connection]
<purple_apple>
nah. its good to learn this. its very common in ruby.
<funkytwig>
but I guess I have to change 'one = One.new' to one = Puddle::One.net? Promise thats the last question......for now.
<purple_apple>
.new, yes
* funkytwig
is off to learn about blanching in git
<purple_apple>
gl, have fun
cdg has joined #ruby
Paraxial has quit [Remote host closed the connection]
Paraxial has joined #ruby
mark_on_the_moon has quit [Ping timeout: 255 seconds]
hahuang61 has joined #ruby
gusrub has joined #ruby
belmoussaoui_ has quit [Quit: belmoussaoui_]
<purple_apple>
lots of comedians in ##C
hahuang61 has quit [Ping timeout: 240 seconds]
<purple_apple>
strange. very different mood in ##C. don't appear concerned with gender politics at all. it's like irc in 1998.
jackjackdripper has quit [Quit: Leaving.]
Alina-malina has quit [Ping timeout: 240 seconds]
alex`` has quit [Ping timeout: 255 seconds]
vondruch has quit [Quit: vondruch]
gusrub has quit [Remote host closed the connection]
vondruch has joined #ruby
<SeepingN>
uhm huh
<SeepingN>
why would thy
Alina-malina has joined #ruby
naprimer2 has quit [Ping timeout: 248 seconds]
<purple_apple>
nvm. not even worth getting into. ends up being a troll fest every time. just quite different mood given current climate.
cdg has quit [Remote host closed the connection]
nobitanobi has quit [Remote host closed the connection]
belmoussaoui has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
cagomez has joined #ruby
Yxhuvud has quit [Remote host closed the connection]
Alina-malina has quit [Ping timeout: 255 seconds]
AnoHito has quit [Read error: Connection reset by peer]
mark_on_the_moon has joined #ruby
AnoHito has joined #ruby
belmoussaoui has quit [Quit: belmoussaoui]
Alina-malina has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
lasey has quit [Ping timeout: 240 seconds]
gusrub has joined #ruby
lasey has joined #ruby
belmoussaoui has joined #ruby
rwb has joined #ruby
jameser has joined #ruby
belmoussaoui has quit [Quit: belmoussaoui]
roshanavand has quit [Ping timeout: 248 seconds]
beilabs_ has joined #ruby
username1 has quit [Ping timeout: 240 seconds]
beilabs_ has quit [Ping timeout: 248 seconds]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mark_on_the_moon has quit [Ping timeout: 240 seconds]