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
<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
<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.
<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]
<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>
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]