havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.0, 2.7.2, 2.6.6: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.org | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | BLM <3
dasher00 has quit [Ping timeout: 246 seconds]
kaivai has quit [Quit: ZNC - https://znc.in]
kaivai has joined #ruby
kaivai has quit [Remote host closed the connection]
s3nd1v0g1us has quit [Ping timeout: 240 seconds]
Swyper has quit [Remote host closed the connection]
kaivai has joined #ruby
s3nd1v0g1us has joined #ruby
kaivai has quit [Client Quit]
jla has quit [Ping timeout: 246 seconds]
kaivai has joined #ruby
shtirlic has joined #ruby
shtirlic has quit [Client Quit]
shtirlic has joined #ruby
<deimos_> like benchmark?
shtirlic has quit [Client Quit]
shtirlic has joined #ruby
Rounin has quit [Ping timeout: 240 seconds]
shtirlic_ has joined #ruby
shtirlic has quit [Ping timeout: 264 seconds]
moldorcoder7 has quit [Ping timeout: 256 seconds]
moldorcoder7 has joined #ruby
chouhoulis has joined #ruby
Technodrome has joined #ruby
shtirlic_ has quit [Quit: leaving]
dfucci has joined #ruby
dfucci has quit [Ping timeout: 265 seconds]
shtirlic has joined #ruby
shtirlic has quit [Client Quit]
shtirlic has joined #ruby
shtirlic has quit [Client Quit]
shtirlic has joined #ruby
alexherbo2 has quit [Ping timeout: 240 seconds]
shtirlic has quit [Client Quit]
shtirlic has joined #ruby
shtirlic has quit [Client Quit]
shtirlic has joined #ruby
shtirlic has quit [Client Quit]
shtirlic has joined #ruby
shtirlic has quit [Client Quit]
shtirlic has joined #ruby
shtirlic has quit [Client Quit]
shtirlic has joined #ruby
dviola has quit [Quit: WeeChat 3.0]
dviola has joined #ruby
baojg has joined #ruby
<deimos_> not quite that, but maybe close to what you want, https://rbspy.github.io/
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has joined #ruby
dfucci has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
kristian_on_linu has quit [Remote host closed the connection]
Swyper has joined #ruby
bvdw48 has quit [Quit: The Lounge - https://thelounge.chat]
bvdw48 has joined #ruby
Vingador has joined #ruby
<nakilon> okay, made it myself https://dpaste.org/Ft8r/slim
jenrzzz has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
s2013 has joined #ruby
envex has quit [Remote host closed the connection]
envex has joined #ruby
lightstalker has quit [Ping timeout: 240 seconds]
lightstalker has joined #ruby
ChmEarl has quit [Quit: Leaving]
neshpion has quit [Quit: neshpion]
chouhoulis has quit [Remote host closed the connection]
gix has joined #ruby
dfucci has joined #ruby
gix_ has quit [Ping timeout: 272 seconds]
deimos_ has quit [Quit: leaving]
jenrzzz has quit [Ping timeout: 240 seconds]
dfucci has quit [Ping timeout: 265 seconds]
deimos_ has joined #ruby
fercell has joined #ruby
FastJack has quit [Ping timeout: 240 seconds]
FastJack has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
m27frogy has quit [Ping timeout: 246 seconds]
elcuervo has joined #ruby
cuerbot has quit [Read error: Connection reset by peer]
s3nd1v0g1us has quit [Quit: WeeChat 3.0.1]
ch3ster has joined #ruby
<ch3ster> Hi I'm trying to install rubygems after I just installed ruby. I'm following the instructions from https://jekyllrb.com/docs/installation/ubuntu/ and it says to avoid installing gems as root user. It then says "set up a gem installation directory for your user account". On the last step, when I do `gem install jekyll bundler`, does that mean I do that in ~/Git or do I do it a specific repo for which is my usrname for githubpages: ~/Git/mygithubuserna
<ch3ster> me.github.io/ dir as my ~/Git dir will have other directorys for other git clones that might not use gems..
dfucci has joined #ruby
dfucci has quit [Ping timeout: 272 seconds]
_whitelogger has joined #ruby
jenrzzz has joined #ruby
ch3ster has quit [Quit: Leaving]
nofxx_ has joined #ruby
nofxx has quit [Ping timeout: 264 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dfucci has joined #ruby
Swyper has quit [Remote host closed the connection]
gix has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
sinan has joined #ruby
arahael has left #ruby ["WeeChat 2.7.1"]
jenrzzz has quit [Ping timeout: 240 seconds]
jla has joined #ruby
steph_ has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
teclator has joined #ruby
jenrzzz has joined #ruby
lightstalker has quit [Ping timeout: 264 seconds]
jenrzzz has quit [Ping timeout: 256 seconds]
baojg has quit [Remote host closed the connection]
jla has quit [Ping timeout: 240 seconds]
sinan has quit [Remote host closed the connection]
jenrzzz has joined #ruby
lightstalker has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
alexherbo2 has joined #ruby
Vingador has quit [Remote host closed the connection]
schne1der has joined #ruby
dinfuehr has quit [Ping timeout: 240 seconds]
dinfuehr has joined #ruby
Rounin has joined #ruby
gearnode has joined #ruby
vondruch has quit [Ping timeout: 264 seconds]
vondruch has joined #ruby
AndreYuhai has joined #ruby
<AndreYuhai> How can I use alias_method only if the method that I want to alias actually exists?
<AndreYuhai> alias_method :foo, :bar if respond_to? :bar is still throwing undefined method error.
cnsvc has quit [Ping timeout: 268 seconds]
weaksauce has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
<wnd> AndreYuhai, you probably wanted to check something like `if instance_methods.include?(:bar)`
jenrzzz has quit [Ping timeout: 256 seconds]
<AndreYuhai> wnd, Why can I not use respond_to? for that though? I am just wondering what's wrong. Oh by the way I am creating my methods with singleton_class.instance_eval as well
<AndreYuhai> I will send a repl link
<wnd> afaik class would be the receiver of respond_to?, not a class instance
<wnd> if you had `def self.bar`, class-scope respond_to?(:bar) would be truthy
<AndreYuhai> wnd, so inside singleton_class.instance_eval, the receiver is the class, right?
<wnd> I haven't played with singletons and *eval too much, so I'd be guessing if I tried to answer
<AndreYuhai> oh okay, thank you for the help wnd ! instance_methods way works, I was only focused on respond_to? way so much that I didn't even think of any alternative way.
<wnd> Well, respond_to? ought to be better when you can use it. At the very least instance_methods.include? is O(n) operation, while respond_to? probably checks against a hash.
<wnd> Now I'm just guessing, but if you're dealing with a singleton, maybe you could try instance.respond_to?
postmodern has quit [Quit: Leaving]
jenrzzz has joined #ruby
coniptor has quit [Ping timeout: 246 seconds]
<phaul> with singleton_class.instance_eval { def... } you are defining class methods of the singleton class, whereas to make it a class method of the current class you would want to define instantance method of the singleton class. You can do that by singleton_class.class_eval { def ...}
<phaul> &>> class X; singleton_class.instance_eval { def foo; end }; end; X.singleton_class.foo
<rubydoc> # => nil (https://carc.in/#/r/adiv)
<phaul> &>> class X; singleton_class.class_eval { def foo; end }; end; X.foo
<rubydoc> # => nil (https://carc.in/#/r/adiw)
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul> but..:
<phaul> &>> class X; singleton_class.instance_eval { def foo; end }; end; X.foo
<rubydoc> # => -e:4:in `<main>': undefined method `foo' for X:Class (NoMethodError)... check link for more (https://carc.in/#/r/adix)
ruurd has quit [Quit: bye folks]
coniptor has joined #ruby
<phaul> &>> class X; singleton_class.instance_eval { def foo; end }; end; X.singleton_class.singletgon_class.instance_methods.include? :foo
<rubydoc> # => -e:4:in `<main>': undefined method `singletgon_class' for #<Class:X> (NoMethodError)... check link for more (https://carc.in/#/r/adiy)
<phaul> &>> class X; singleton_class.instance_eval { def foo; end }; end; X.singleton_class.singleton_class.instance_methods.include? :foo
<rubydoc> # => true (https://carc.in/#/r/adiz)
vondruch has quit [Ping timeout: 240 seconds]
akem has quit [Read error: Connection reset by peer]
<AndreYuhai> phaul, So I can not check respond_to? inside singleton_class.class_eval, right?
<AndreYuhai> something like this: https://ghostbin.co/paste/jzh56
somazero has quit [Quit: Leaving]
<AndreYuhai> Basically sometimes a specific key value pair is not passed to the initialize method, then this class throws an error. So I just wanted to avoid that undefined method error checking whether key value pair was actually passed by using respond_to?. I thought that would work, but it didn't so as wnd suggested above I've started using instance_methods
Nahra has joined #ruby
<phaul> That's not quite what I meant.. When you define methods with AnyClass.instance_eval, you are defining class methods for AnyClass as opposed to instance methods in the class.
<phaul> this is the problem I was pointing out:
<phaul> &>> class X; def initialize; singleton_class.instance_eval { def zzz; end }; end; end; X.new.zzz
<rubydoc> # => -e:4:in `<main>': undefined method `zzz' for #<X:0x0000559bd94ee240> (NoMethodError)... check link for more (https://carc.in/#/r/adjj)
<phaul> &>> class X; def initialize; singleton_class.class_eval { def zzz; end }; end; end; X.new.zzz
<rubydoc> # => nil (https://carc.in/#/r/adjl)
Technodrome has joined #ruby
<AndreYuhai> phaul, oh now I understand that difference thank you. So inside instance_eval and class_eval what are the receiving objects?
ChewyB has joined #ruby
ChewyB has quit [Read error: Connection reset by peer]
ChewyB has joined #ruby
m27frogy has joined #ruby
<phaul> self seems to be set to the receiver of the eval in either case, I imagine the current class is set differently. That drives where def-defined methods ends up.
jla has joined #ruby
linoge has joined #ruby
einyoul has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
linoge has quit [Remote host closed the connection]
linoge has joined #ruby
<AndreYuhai> phaul, yes that helps thank you! So I could either put the if outside the block or just use instance_methods.include? :foo inside the block
linoge has quit [Remote host closed the connection]
fercell has quit [Ping timeout: 256 seconds]
fercell has joined #ruby
<phaul> yes
linoge has joined #ruby
linoge has quit [Remote host closed the connection]
linoge has joined #ruby
steph_ has quit [Ping timeout: 258 seconds]
fercell has quit [Ping timeout: 264 seconds]
linoge has quit [Remote host closed the connection]
fercell has joined #ruby
steph_ has joined #ruby
linoge has joined #ruby
jla has quit [Ping timeout: 240 seconds]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
steph_ has quit [Ping timeout: 272 seconds]
Rudd0 has quit [Ping timeout: 246 seconds]
zapata has quit [Quit: WeeChat 3.0.1]
steph_ has joined #ruby
jla has joined #ruby
cow[moo] has joined #ruby
englishm_ has quit [Ping timeout: 240 seconds]
jerme_ has quit [Ping timeout: 240 seconds]
d10n-work has quit [Ping timeout: 246 seconds]
missionary has quit [Ping timeout: 264 seconds]
Phoebus has quit [Ping timeout: 264 seconds]
jnoon has quit [Ping timeout: 240 seconds]
sorah has quit [Ping timeout: 265 seconds]
podman has quit [Read error: No route to host]
c355e3b has quit [Read error: Connection reset by peer]
peteretep_ has quit [Read error: Connection reset by peer]
kermit has quit [Ping timeout: 260 seconds]
gmcintire has quit [Read error: Connection reset by peer]
Atro has quit [Write error: Connection reset by peer]
afisher has quit [Read error: Connection reset by peer]
maxmanders has quit [Read error: Connection reset by peer]
Net has quit [Read error: Connection reset by peer]
integral has quit [Read error: Connection reset by peer]
BuildTheRobots has quit [Read error: Connection reset by peer]
cstrahan has quit [Read error: Connection reset by peer]
hahuang65 has quit [Read error: Connection reset by peer]
meinside has quit [Read error: No route to host]
Pillus has quit [Read error: Connection reset by peer]
JayDoubleu has quit [Read error: Connection reset by peer]
DerekNonGeneric has quit [Read error: Connection reset by peer]
AutomationD has quit [Write error: Connection reset by peer]
jimcroft has quit [Read error: Connection reset by peer]
ec has quit [Read error: Connection reset by peer]
stryek has quit [Read error: Connection reset by peer]
chromis has quit [Read error: Connection reset by peer]
rann has quit [Read error: Connection reset by peer]
coffeejunk has quit [Read error: Connection reset by peer]
Liothen has quit [Read error: Connection reset by peer]
entel has quit [Read error: Connection reset by peer]
kwilczynski has quit [Read error: Connection reset by peer]
graphicsv has quit [Read error: Connection reset by peer]
jhill has quit [Read error: Connection reset by peer]
CustosLimen has quit [Read error: Connection reset by peer]
itok has quit [Read error: Connection reset by peer]
evil has quit [Read error: Connection reset by peer]
missionary has joined #ruby
gmcintire has joined #ruby
peteretep_ has joined #ruby
afisher has joined #ruby
cstrahan has joined #ruby
chromis has joined #ruby
c355e3b has joined #ruby
integral has joined #ruby
meinside has joined #ruby
Phoebus has joined #ruby
kermit has joined #ruby
Liothen has joined #ruby
kwilczynski has joined #ruby
jhill has joined #ruby
dinfuehr has quit [Ping timeout: 264 seconds]
EdwardIII has quit [Ping timeout: 246 seconds]
DerekNonGeneric has joined #ruby
Iambchop has quit [Ping timeout: 272 seconds]
jerme_ has joined #ruby
evil has joined #ruby
hahuang65 has joined #ruby
entel has joined #ruby
stryek has joined #ruby
JayDoubleu has joined #ruby
ec has joined #ruby
englishm_ has joined #ruby
BuildTheRobots has joined #ruby
CustosLimen has joined #ruby
dinfuehr has joined #ruby
Pillus has joined #ruby
jimcroft has joined #ruby
Net has joined #ruby
coffeejunk has joined #ruby
d10n-work has joined #ruby
itok has joined #ruby
EdwardIII has joined #ruby
podman has joined #ruby
jnoon has joined #ruby
Atro has joined #ruby
fercell has quit [Ping timeout: 272 seconds]
vondruch has joined #ruby
fercell has joined #ruby
jla has quit [Ping timeout: 246 seconds]
dnadev2 has joined #ruby
Iambchop has joined #ruby
sorah has joined #ruby
rann has joined #ruby
maxmanders has joined #ruby
AutomationD has joined #ruby
jla has joined #ruby
graphicsv has joined #ruby
cd has quit [Quit: cd]
dnadev2 has quit [Quit: Leaving]
moldorcoder7 has quit [Ping timeout: 246 seconds]
ChewyB has quit [Read error: Connection reset by peer]
Swyper has quit [Ping timeout: 264 seconds]
moldorcoder7 has joined #ruby
roshanavand has joined #ruby
jla has quit [Ping timeout: 265 seconds]
zapata has joined #ruby
Swyper has joined #ruby
chouhoulis has joined #ruby
chouhoulis has quit [Read error: Connection reset by peer]
chouhoul_ has joined #ruby
chouhoul_ has quit [Remote host closed the connection]
chouhoulis has joined #ruby
croberts has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
duckpuppy has quit [Quit: ZNC 1.8.2 - https://znc.in]
duckpuppy has joined #ruby
akem has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
akem has quit [Remote host closed the connection]
akem has joined #ruby
s2013 has joined #ruby
Technodrome has joined #ruby
prepend has joined #ruby
grummund has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
goepsilongo has joined #ruby
s2013 has joined #ruby
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU_ has joined #ruby
fandre1986 has joined #ruby
Nahra has quit [Quit: leaving]
jla has joined #ruby
dhollin is now known as dhollinger
Rudd0 has joined #ruby
rwb has quit [Quit: rwb]
DTZUZU_ has quit [Read error: Connection reset by peer]
GodFather has joined #ruby
fercell has quit [Ping timeout: 264 seconds]
fercell has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
nickwinlund1 has joined #ruby
<nickwinlund1> big speed difference between installing gems on RPi 3 (1 GB ram) vs RPi 4 (8 GB)
<nickwinlund1> kovid is a nice stats program
ChewiB has joined #ruby
<al2o3-cr> xco wrote the kovid gem, he frequents here often :)
akem123 has quit [Ping timeout: 240 seconds]
akem has quit [Ping timeout: 256 seconds]
akem123 has joined #ruby
Nahra has joined #ruby
dfucci has joined #ruby
schne1der has quit [Quit: schne1der]
dfucci has quit [Ping timeout: 240 seconds]
DTZUZU has joined #ruby
ChewiB has quit [Remote host closed the connection]
howdoi has joined #ruby
DTZUZU has quit [Read error: Connection reset by peer]
Besnik_b has left #ruby ["Po dal ca…"]
ChmEarl has joined #ruby
nickwinlund1 has quit [Quit: WeeChat 2.3]
cthulchu has joined #ruby
dfucci has joined #ruby
millerti has joined #ruby
dfucci has quit [Ping timeout: 260 seconds]
hiroaki has joined #ruby
DTZUZU has joined #ruby
cuerbot has joined #ruby
elcuervo has quit [Ping timeout: 240 seconds]
neshpion has joined #ruby
weaksauce has joined #ruby
AndreYuhai has quit [Quit: Leaving]
<nakilon> was there a string interpolation feature that would take fields from Struct?
<nakilon> ah, found it: "foo = %{foo}" % {foo: 'bar'} # => "foo = bar"
<nakilon> but that's not Struct, anyway
queip has quit [Read error: Connection reset by peer]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
missionary has quit [Quit: Connection closed for inactivity]
dfucci has joined #ruby
RougeR has joined #ruby
<RougeR> heya
<RougeR> been a while since ive touched ruby, having issues in sinatra requiring files when using rack
<RougeR> ive googled and seen there are issue with require relative potentially and rack but could just be me
jla has quit [Ping timeout: 256 seconds]
queip has joined #ruby
<RougeR> code: Dir.glob(File.expand_path("../app/models/*.rb", __FILE__)).each {|f| require_relative f }
<RougeR> wait nvm
<RougeR> -_--
<RougeR> went up another directory and it fixed it...good ol rubber ducky
<nakilon> &>> %i{ a b c d }.combination(3).reverse_each.with_index.map{ |x, i| [i, x] }
<rubydoc> # => [[0, [:b, :c, :d]], [1, [:a, :c, :d]], [2, [:a, :b, :d]], [3, [:a, :b, :c]]] (https://carc.in/#/r/adqe)
<nakilon> &>> t = %i{ a b c d }; t.size.times.map{ |i| [i, t.dup.tap{ |_| _.delete_at i }] }
<rubydoc> # => [[0, [:b, :c, :d]], [1, [:a, :c, :d]], [2, [:a, :b, :d]], [3, [:a, :b, :c]]] (https://carc.in/#/r/adqf)
<nakilon> 1) which one is better? the first one is a single chained expression, does not use temp identifier but it hardcodes the '3'
<nakilon> 2) is combination() guaranteed to emit items in the same order in the next Ruby versions?
<RougeR> be useful to explain what the aim of the code is
<RougeR> afk
<havenwood> nakilon: "The order of combinations is indeterminate."
podman has quit [Ping timeout: 240 seconds]
peteretep_ has quit [Read error: Connection reset by peer]
coffeejunk has quit [Read error: Connection reset by peer]
podman has joined #ruby
coffeejunk has joined #ruby
peteretep_ has joined #ruby
roshanavand has quit [Remote host closed the connection]
magesh has joined #ruby
millerti has quit [Ping timeout: 260 seconds]
<RougeR> either way, break it up on to more lines, at least when asking for help/opnions imo. nested blocks and long chains are always iffy
Eiam has quit [Quit: (╯°□°)╯︵ ǝpouǝǝɹɟ]
<havenwood> nakilon: That second solution isn't generalizable, but you're right to worry that #combination isn't stable.
<nakilon> havenwood, yeah, I chose the 2nd
<nakilon> what do you mean by 'not generalizable'?
cnsvc has joined #ruby
<havenwood> nakilon: If the collection size is increased by one, for example, then it's no longer a combo of 3.
<havenwood> nakilon: With those constraints, you could do arbitrary solutions like:
<havenwood> &>> %i{a b c d}.then { |chars| Array.new(chars.size) { |n| chars.rotate(n).take(3).sort }.rotate }
<rubydoc> # => [[:b, :c, :d], [:a, :c, :d], [:a, :b, :d], [:a, :b, :c]] (https://carc.in/#/r/adqp)
<nakilon> havenwood, oh, but it's 1st one that has '3' hardcoded, not 2nd
Swyper has quit [Remote host closed the connection]
<nakilon> heh, rotate is cool
<nakilon> what is then? is it a tap with break?
<nakilon> nice thing but I don't like the name, would prefer something like .init or .declare
<nakilon> because .then sounds like it's from if-conditional
<havenwood> nakilon: #then or then alias #yield_self are like #tap but the result of the block is returned
<havenwood> nakilon: or a sized Enumerator, if no block is given
<nakilon> ah, I guess I heard about yield_self, that's better
<havenwood> nakilon: I did the PR to change it from an unsized to sized enumerator, heh.
<nakilon> it's like x.tap{ |y| break ( .......... ) }
duderonomy has joined #ruby
gix has joined #ruby
<havenwood> nakilon: That's ^ my stab at a pure Ruby version (with guidance from Eregon).
<nakilon> what does { 1 } mean?
<havenwood> nakilon: It's the lazy count.
<havenwood> nakilon: That was my contribution to the spec, giving it a lazy count of one.
<havenwood> nakilon: I liked it, because it let me define `rb_obj_size` of `1`. :P
<havenwood> nakilon: Somehow the idea that an object knows it is one felt nice to add.
<havenwood> nakilon: I don't write much C, so I'm proud even though it's incredibly trivial.
<havenwood> Hard to get more trivial. >.>
<havenwood> But I can say I defined a function on Ruby Object! :)
<havenwood> &>> 42.then.size
<rubydoc> # => 1 (https://carc.in/#/r/adr7)
<havenwood> nakilon: ^
<havenwood> nakilon: It used to be `nil`, and that's what the `{ 1 }` is doing, making it a sized rather than unsized Enumerator.
<havenwood> &>> 42.then
<rubydoc> # => #<Enumerator: 42:then> (https://carc.in/#/r/adr9)
<havenwood> &>> 42.then.to_a
<rubydoc> # => [42] (https://carc.in/#/r/adra)
<havenwood> nakilon: It's a bit odd, huh?
<havenwood> nakilon: This is the most fun I'd had with #then, I think https://gist.github.com/havenwood/b0c6bdd59be549a6bb701b575480e55b
<havenwood> Nobody has starred it, but I think it's nifty.
s3nd1v0g1us has joined #ruby
<havenwood> I guess also ugly. Nifty but ugly.
<havenwood> The &:s...
Technodrome has joined #ruby
Nahra has quit [Quit: leaving]
easbarbosa has joined #ruby
bvdw48 has quit [Quit: The Lounge - https://thelounge.chat]
lucasm has joined #ruby
bvdw has joined #ruby
bvdw has quit [Client Quit]
lucasm has quit [Client Quit]
bvdw has joined #ruby
<nakilon> that's confusing because... let me guess...
<nakilon> &>> 42.then{}.size
<rubydoc> # => -e:4:in `<main>': undefined method `size' for nil:NilClass (NoMethodError)... check link for more (https://carc.in/#/r/adrt)
<nakilon> &>> 42.then(&:itself).size
<rubydoc> stderr: Directory tree /home/carcin/carcin/sandboxes/host/glibc-2.31 is currently busy. (https://carc.in/#/r/adrv)
<nakilon> hm
<havenwood> &>> 42.then(&:itself)
<rubydoc> # => 42 (https://carc.in/#/r/adrz)
easbarbosa has quit [Quit: ERC (IRC client for Emacs 27.1)]
<nakilon> &>> 42.then(&:itself).size
<rubydoc> # => 8 (https://carc.in/#/r/ads2)
<havenwood> &>> 42.then.size - 42.then(&:itself).size
<rubydoc> # => -7 (https://carc.in/#/r/ads5)
easbarbosa has joined #ruby
easbarbosa has quit [Remote host closed the connection]
easbarbosa has joined #ruby
Swyper has joined #ruby
<havenwood> nakilon: 42.then isn't 42 itself, so different result.
<havenwood> &>> 42.then.lazy.force
<rubydoc> # => [42] (https://carc.in/#/r/adsa)
Swyper has quit [Remote host closed the connection]
<havenwood> &>> 42.then.itself.then(&:itself).then(&:lazy).lazy.then(&:then).lazy.force.map(&:lazy).map(&:force)
<rubydoc> # => [[42]] (https://carc.in/#/r/adsb)
<havenwood> nakilon: ^
<nakilon> omg
fandre1986 has quit [Quit: Connection closed]
<nakilon> &>> 42.then.to_a.zip # should be shorter
<rubydoc> # => [[42]] (https://carc.in/#/r/adsd)
Swyper has joined #ruby
al2o3-cr has quit [Ping timeout: 256 seconds]
fercell has quit [Ping timeout: 264 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
knightblader has joined #ruby
<RougeR> damn ugh im so confused on require imports
<havenwood> RougeR: What's the trouble?
<RougeR> i think ive been having issues with rack and imports being handled slightly differently
<RougeR> when i stick a binding.pry breakpoint in and rerun the code, the require_relative statements run fine
<RougeR> hit the breakpoint on line 10 and ApplicationController throws unitialized constant
<RougeR> rerun the Dir.glob on line 2 from the debugger and it works fine
<RougeR> doesnt help that every guide on the internet seems to configure sinatra slightly different and most dont use modular pattern
al2o3-cr has joined #ruby
ur5us has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
dhollinger has quit [Ping timeout: 240 seconds]
<adam12> RougeR: Use `sort: true` inside your glob. Some filesystems return files non-deterministically, which can cause strange errors.
ritsch_master has joined #ruby
jenrzzz has joined #ruby
<RougeR> ahh yeah i had seen that
<RougeR> will add in
orbyt_ has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<RougeR> f it...managed to sort it with require_all
dhollinger has joined #ruby
magesh has quit [Quit: Leaving]
jenrzzz has quit [Ping timeout: 240 seconds]
Swyper has quit [Remote host closed the connection]
<RougeR> okay, thank f
<RougeR> its working....you wouldnt think I was full time sinatra dev for 2 years!
<RougeR> took me all day to get a basic application running with rspec
<nakilon> sounds fun
<adam12> RougeR: Weird.
<RougeR> adam12, you just forget stuff if you dont do it
<RougeR> I havnt touched ruby for a year
<RougeR> and the documentation for sinatra as a modular application is pretty lacking
<nakilon> in my country people aren't even aware of any other server than rails
<nakilon> they even host 1 page landings on it
<nakilon> (static)
<RougeR> yeah here sinatra isnt that well used. Its a real shame
<RougeR> I worked on a video streaming backend with resque/sinatra
easbarbosa has quit [Remote host closed the connection]
<nakilon> there was a joke "hey, you are programmer? fix my computer then" now it's "hey, you are rubyist? make us a website" for me
<RougeR> ive mostly left the ruby world for python...i really enjoy ruby...but i hate rails
<nakilon> *rails website
<RougeR> yeah i getcha
<RougeR> im a backend dev...rails stuff doesnt really float my boat. He says as he does a rails job tech test in sinatra
<RougeR> flask is my favourite framework ive worked with so far, once you figure out the initial pain its great
<havenwood> RougeR: Give Roda a try.
<RougeR> nay heard of it, will google
hiroaki has quit [Ping timeout: 272 seconds]
<havenwood> RougeR: https://roda.jeremyevans.net/
<RougeR> ooh
<RougeR> "Roda aims to take the ease of development and understanding that Sinatra brings, and enable it to scale to support the development of large web applications."
<RougeR> nice
<RougeR> havenwood, im impressed looks really good. digging the documentation as well
<RougeR> will definetly give it a go next time i reach for sinatra
<havenwood> RougeR: The plugins it ships with are top notch.
<adam12> I use Roda on a bunch of projects. Works well.
<RougeR> yeah im just looking through them too
<RougeR> they make a lot of sense
<RougeR> looks a lot more like a flask for ruby than sinatra
s2013 has joined #ruby
<havenwood> RougeR: Flask and Roda were both inspired by Sinatra, so makes sense.
<RougeR> ahh neat
<RougeR> sinatra just feels a bit eh messy now in comparison
<havenwood> RougeR: Roda is just so nice to work with.
<RougeR> yeah it looks it
<RougeR> my big issue with "micro-frameworks" is the lack of focus and documentation on larger applications
mozzarella has quit [Read error: Connection reset by peer]
<RougeR> there is a good 3rd party guide for that i can see linked here
<RougeR> for ruby its just >use rails
<RougeR> but nty
<havenwood> RougeR: Yes, there are some good ones. https://janko.io/introduction-to-roda/
TCZ has joined #ruby
dviola has quit [Quit: WeeChat 3.0]
dviola has joined #ruby
<RougeR> its a real shame ruby never diversified more and got pigeon holed into rails and monolithic web dev
dasher00 has joined #ruby
<RougeR> i know its used in other tooling, but its just got nothing on python in terms of breadth
linoge has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 260 seconds]
ur5us has joined #ruby
<nakilon> is janko on freenode?
cd has joined #ruby
landakram has joined #ruby
evdubs has quit [Remote host closed the connection]
evdubs has joined #ruby
knightblader has quit [Quit: WeeChat 1.9.1]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
henninb has joined #ruby
<isene> I'm trying to combine number formatting with both "%f" and "%g", but can't find a way - is this even possible? The result I want is to have the number 1.23456 displayed as 1.2346 (using ' n.round(4) ' and ' "%.4f" % n ' BUT, I also want the number 123456 to displayed as 1.2346e+05 (using %4g here). Do I need to split them manually with an if n > 10000 ? Or can they somehow be combined?
vondruch has quit [Read error: Connection reset by peer]
<nakilon> isene maybe you want if (n % 1).zero?
dhollinger has quit [Quit: WeeChat 2.3]
alexherbo2 has quit [Ping timeout: 264 seconds]
goepsilongo has quit [Quit: goepsilongo]
<RougeR> well that was a fun bug
<RougeR> sinatra-contrib was polluting namespace intercepting rake’s DSL and failing.
<RougeR> this is why ive come to prefer explicit imports
al2o3-cr has quit [Quit: WeeChat 3.0]
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
al2o3-cr has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
<RougeR> goddamn
<RougeR> they never fixed it...just "use the work around"
ur5us_ has joined #ruby
henninb has quit [Quit: leaving]
landakram has quit [Ping timeout: 264 seconds]
ur5us has quit [Ping timeout: 264 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TCZ has quit [Remote host closed the connection]
ritsch_master has quit [Ping timeout: 240 seconds]
cliluw has joined #ruby
dfucci has joined #ruby
gearnode has quit [Ping timeout: 240 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
<RougeR> goddamn. 2 hours trying to fix that
<nakilon> some people say "if something takes more than 2 hours to fix it, reject it and fix another jira ticket" ..D
gearnode has joined #ruby
meinside has quit [Ping timeout: 240 seconds]
jnoon has quit [Read error: Connection reset by peer]
jnoon has joined #ruby
meinside has joined #ruby
<RougeR> nakilon, hehe i feel like that was the answer here
ropeney_ has quit [Quit: ZNC 1.7.4 - https://znc.in]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
x0n- has joined #ruby
x0n has quit [Ping timeout: 246 seconds]
peder has quit [Ping timeout: 265 seconds]
zacts has joined #ruby
prestorium has joined #ruby
mic_e_ has quit [Quit: No Ping reply in 180 seconds.]
mic_e has joined #ruby
goepsilongo has joined #ruby
peder has joined #ruby
ur5us_ has quit [Ping timeout: 264 seconds]
orbyt_ has joined #ruby
cthulchu has quit [Ping timeout: 256 seconds]
<nakilon> how do you name the method that returns an object that has some specific singleton method(s)?
<nakilon> def mycoolobject_factory ?
<nakilon> def create_mycoolobject ?
<nakilon> imagine that I don't want to declare a class MyCoolObject
RougeR has quit [Remote host closed the connection]
dumptruckman has quit [Ping timeout: 260 seconds]