havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.1, 3.0.3, 2.7.5: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
MaXxer00 has joined #ruby
MaXxer0 has quit [Ping timeout: 250 seconds]
seifeslimene has joined #ruby
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
<mooff> ox1eef.. you got me trying to do the prototype thing, but using modules :)
<ox1eef> cool +1. i also want to add, Object.create(nil, SomeMod) as well as a block.
<ox1eef> to keep it close to JS, i think you should consider having a #prototype method, so.. obj.create(...).prototype.prototype.prototype etc should work. then, hasOwnProperty should have an equivalent as well.
<ox1eef> delete(obj[foo]) should have an equivalent.
Guest65 has joined #ruby
seifeslimene has quit [Ping timeout: 256 seconds]
<mooff> that Prototype#prototype might read ancestors.find { |m| m != self and m.is_a? Prototype }
<ox1eef> could be, honestly i'm not sure. i think a linked list implementation is going to be what will work best, there's a few things which should work to be similar to JS. Object.create(nil) basically creates an openstruct-like object in my case.
<mooff> ah, i see!
<mooff> you've basically ported JS's Object :)
<ox1eef> i tried to get as close as i could
Rounin has quit [Ping timeout: 272 seconds]
<mooff> i read your ObjectMixin, thought of modules and was off to the races
<ox1eef> :)
<mooff> neat
<mooff> i think the deletion behaves differently to JS
MaXxer0 has joined #ruby
comet23 has quit [Quit: Client closed]
MaXxer00 has quit [Ping timeout: 240 seconds]
<mooff> whereas delete o['foo'] in JS will let o.foo traverse again, deletion cascades with your lib
roadie has joined #ruby
roadie has quit [Ping timeout: 252 seconds]
gr33n7007h has quit [Ping timeout: 268 seconds]
gr33n7007h has joined #ruby
<ox1eef> that would be something to fix then, the hope is to be as close to JS as possible
<ox1eef> mooff: do you have an example case of that to try out?
<ox1eef> ah indeed, i see it, thanks!
<mooff> cool :)
Guest65 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
John_Ivan has quit [Ping timeout: 272 seconds]
eldritch_ is now known as eldritch
ur5us_ has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
Guest65 has joined #ruby
szkl has quit [Quit: Connection closed for inactivity]
reset has quit [Quit: reset]
hololeap has quit [Ping timeout: 240 seconds]
hololeap has joined #ruby
FetidToot9 has joined #ruby
MaXxer0 has quit [Quit: Leaving]
FetidToot has quit [Ping timeout: 252 seconds]
FetidToot has joined #ruby
Thanzex has quit [Read error: Connection reset by peer]
Thanzex has joined #ruby
FetidToot9 has quit [Ping timeout: 240 seconds]
Guest65 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ox1eef> probably other edge cases though
Guest65 has joined #ruby
<ox1eef> i wish standardrb was the standard, and rubocop just the tool that drove it. maybe one day.
roadie has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
rawley has quit [Ping timeout: 260 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
RedNifre2 has quit [Ping timeout: 272 seconds]
RedNifre2 has joined #ruby
thad_the_man has joined #ruby
gproto23 has joined #ruby
weyhmueller has quit [Quit: ZNC 1.8.2 - https://znc.in]
weyhmueller has joined #ruby
cout has quit [*.net *.split]
pandabot has quit [*.net *.split]
leftylink has quit [*.net *.split]
apotheon has quit [*.net *.split]
Spitfire has quit [*.net *.split]
seabre has quit [*.net *.split]
acosta has quit [*.net *.split]
kenichi has quit [*.net *.split]
bastelfreak has quit [*.net *.split]
cout has joined #ruby
Spitfire has joined #ruby
leftylink has joined #ruby
apotheon has joined #ruby
kenichi has joined #ruby
pandabot has joined #ruby
bastelfreak has joined #ruby
acosta has joined #ruby
seabre has joined #ruby
roadie has joined #ruby
ur5us_ has quit [Ping timeout: 272 seconds]
roadie has quit [Ping timeout: 252 seconds]
roadie has joined #ruby
polishdub has joined #ruby
roadie has quit [Ping timeout: 268 seconds]
Guest65 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<isene> Trying to display a number in 'engineering notation' where the exponent is always a multiple of 3 (e.g. 26054 => 26.054e03). Did not find how to accomplish this even after extensive Googling. Anyone?
o|||||o has quit [Ping timeout: 268 seconds]
polishdub has quit [Quit: leaving]
teclator has joined #ruby
roadie has joined #ruby
___nick___ has joined #ruby
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
Rounin has joined #ruby
jhass[m] has quit [Quit: Bridge terminating on SIGTERM]
sixecho has quit [Quit: Bridge terminating on SIGTERM]
hsiktas[m] has quit [Quit: Bridge terminating on SIGTERM]
hideki0[m] has quit [Quit: Bridge terminating on SIGTERM]
kinduff has quit [Quit: Bridge terminating on SIGTERM]
DenKn has quit [Quit: Bridge terminating on SIGTERM]
slact[m] has quit [Quit: Bridge terminating on SIGTERM]
artemon has quit [Quit: Bridge terminating on SIGTERM]
andrea[m] has quit [Quit: Bridge terminating on SIGTERM]
akochi[m] has quit [Quit: Bridge terminating on SIGTERM]
coolshaurya has quit [Quit: Bridge terminating on SIGTERM]
hideki0[m] has joined #ruby
jhass[m] has joined #ruby
hsiktas[m] has joined #ruby
coolshaurya has joined #ruby
sixecho has joined #ruby
kinduff has joined #ruby
DenKn has joined #ruby
andrea[m] has joined #ruby
slact[m] has joined #ruby
artemon has joined #ruby
akochi[m] has joined #ruby
libsys has quit [Remote host closed the connection]
libsys has joined #ruby
infinityfye has joined #ruby
libsys has quit [Remote host closed the connection]
libsys has joined #ruby
dionysus69 has joined #ruby
d-s has quit [Quit: Leaving...]
wks has joined #ruby
<jhass[m]> >> require "bigdecimal"; BigDecimal(26054).to_s("E")
<jhass[m]> Not sure if a great solution...
ruby[bot1 has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
some14u has joined #ruby
some14u has quit [Client Quit]
oxfuxxx has joined #ruby
some14u has joined #ruby
wks has left #ruby [Konversation terminated!]
some14u has quit [Ping timeout: 260 seconds]
some14u has joined #ruby
Furai has quit [Remote host closed the connection]
Furai has joined #ruby
some14u has quit [Ping timeout: 252 seconds]
some14u has joined #ruby
Thanzex has quit [Read error: Connection reset by peer]
Thanzex has joined #ruby
some14u has quit [Ping timeout: 245 seconds]
infinity_fye has joined #ruby
infinityfye has quit [Killed (NickServ (GHOST command used by infinity_fye))]
infinity_fye is now known as infinityfye
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
markong has joined #ruby
nakilon has quit [Remote host closed the connection]
some14u has joined #ruby
oxfuxxx has quit [Ping timeout: 272 seconds]
some14u has quit [Ping timeout: 250 seconds]
<isene> jhass[m]: That works for scientific notation - e.g. 26054 => 0.26054e5, what I need is => 26.054e03 (the exponent always turns out to be a multiple of 3)
<isene> I could write a whole thing on this myself, but wondered if there is some canned solution for this somewhere
<jhass[m]> maybe as a gem
<jhass[m]> floating point printing algo's are actually quite the science in themselves..
some14u has joined #ruby
<jhass[m]> (FWIW BigDecimal#to_s does call it engineering notation :D)
<isene> Reason I need this is for my project "XRPN" - a new programming language (written in Ruby) that is a superset of the FOCAL/RPN language of the venrable HP-41 programmable calculator. It's similar to FORTH in that it is stack based. So far I have implemented the whole 250+ function set as well as a host of modern features (read/write files, read web pages, code injection/deletion for self-modifying
<isene> programs, indirect addressing). It is also extensible like LISP in that any function can be upgraded while a program is running and new functions can be added on the fly. Github soon.
John_Ivan has joined #ruby
<isene> jhass[m]: Yes, they call it engineering notation - but as a math/calculator enthusiast since forever, I know that to be an error :-)
oxfuxxx has joined #ruby
<isene> It's not even a true scientific notation, as that would be => 2.6054e04
<jhass[m]> There's also %e for sprintf/String#%, but that seems to be fixed at one significant digit
ivanf has quit [Ping timeout: 260 seconds]
ivanf has joined #ruby
opv has left #ruby [#ruby]
<jhass[m]> You can steal Crystal's Grisu3 implementation, should be fairly easy to port to Ruby. Should spit everything out to then format the number how you want from a quick glance https://github.com/crystal-lang/crystal/blob/master/src/float/printer/grisu3.cr
<isene> Thanks for the catch. Seems I'm heading for a gem creation :-)
sixecho has quit [Quit: User was banned]
hsiktas[m] has quit [Quit: User was banned]
jhass[m] has quit [Quit: User was banned]
andrea[m] has quit [Quit: User was banned]
DenKn has quit [Quit: User was banned]
hideki0[m] has quit [Quit: User was banned]
kinduff has quit [Quit: User was banned]
artemon has quit [Quit: User was banned]
coolshaurya has quit [Quit: User was banned]
slact[m] has quit [Quit: User was banned]
akochi[m] has quit [Quit: User was banned]
ua_ has quit [Ping timeout: 256 seconds]
ua_ has joined #ruby
d-s has joined #ruby
oxfuxxx has quit [Ping timeout: 250 seconds]
oxfuxxx has joined #ruby
d-s has quit [Read error: Connection reset by peer]
d-s has joined #ruby
d-s has quit [Read error: Connection reset by peer]
d-s has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
ivanf has quit [Ping timeout: 246 seconds]
some14u has quit [Client Quit]
ivanf has joined #ruby
some14u has joined #ruby
gproto23 has quit [Read error: Connection reset by peer]
<mooff> yay new code :-)
foxxx0 has quit [Quit: foxxx0]
foxxx0 has joined #ruby
acosta4 has joined #ruby
acosta has quit [Read error: Connection reset by peer]
acosta4 is now known as acosta
oxfuxxx has quit [Ping timeout: 260 seconds]
oxfuxxx has joined #ruby
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
favadi has joined #ruby
hideki0[m] has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jhass[m] has joined #ruby
hsiktas[m] has joined #ruby
DenKn has joined #ruby
sixecho has joined #ruby
coolshaurya has joined #ruby
slact[m] has joined #ruby
artemon has joined #ruby
kinduff has joined #ruby
andrea[m] has joined #ruby
akochi[m] has joined #ruby
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
rawley has joined #ruby
rawley has quit [Remote host closed the connection]
<isene> mooff: Just wait till I release XRPN. Lots of new code (very algorithm heavy)
Guest48 has joined #ruby
oxfuxxx has quit [Ping timeout: 245 seconds]
oxfuxxx has joined #ruby
Tempesta has quit [Ping timeout: 265 seconds]
oxfuxxx has quit [Read error: Connection reset by peer]
justOkay has quit [Remote host closed the connection]
justOkay has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
o|||||o has joined #ruby
infinity_fye has joined #ruby
infinity_fye has quit [Client Quit]
infinityfye has quit [Ping timeout: 260 seconds]
reset has joined #ruby
cahoots has joined #ruby
<cahoots> hi, i want to get the time that a function took, and Time.now is unsuitable for this due to NTP synchronization. how can i get a relative time?
<jhass[m]> alternatively get the monotonic clock via https://rubyapi.org/3.1/o/process#method-c-clock_gettime
<cahoots> jhass[m], ty
oxfuxxx has joined #ruby
Tempesta has joined #ruby
m_antis_ has quit [Quit: ZNC - https://znc.in]
m_antis has joined #ruby
markong has quit [Ping timeout: 246 seconds]
markong has joined #ruby
mixfix41 has joined #ruby
Guest65 has joined #ruby
Guest65 has quit [Client Quit]
cahoots has quit [Quit: leaving]
Guest65 has joined #ruby
Guest65 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest65 has joined #ruby
Guest65 has quit [Client Quit]
Guest65 has joined #ruby
Guest65 has quit [Client Quit]
Tempesta has quit [Quit: See ya!]
Guest48 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest48 has joined #ruby
oxfuxxx has quit [Ping timeout: 252 seconds]
Tempesta has joined #ruby
rawley has joined #ruby
Guest48 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
d-s has quit [Read error: Connection reset by peer]
d-s has joined #ruby
Tempesta has quit [Ping timeout: 265 seconds]
Tempesta has joined #ruby
aeris has quit [Ping timeout: 240 seconds]
aeris has joined #ruby
markong has quit [Ping timeout: 260 seconds]
Thanzex has quit [Read error: Connection reset by peer]
Thanzex has joined #ruby
davidw has joined #ruby
hololeap has quit [Remote host closed the connection]
hololeap has joined #ruby
ivanf has quit [Ping timeout: 250 seconds]
ivanf has joined #ruby
ivanf has quit [Ping timeout: 246 seconds]
some14u has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mixfix41 has quit [Ping timeout: 272 seconds]
o|||||o has quit [Ping timeout: 246 seconds]
some14u has joined #ruby
mixfix41 has joined #ruby
justOkay has quit [Read error: Connection reset by peer]
justOkay has joined #ruby
o|||||o has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
arosen has joined #ruby
<arosen> Hello I am looking at this line of code resource["/release"].post({component => branch}.to_json)
<arosen> .post({component => branch}.to_json is equivalent to something like: {'component': component, 'branch': branch} I am guessing ?
<arosen> I am not sure this type of syntax { => }
<adam12> arosen: It's a style of Hash creation
<adam12> arosen: But your equivalent isn't accurate, because 'component' could be a method call that returns something. As is 'branch'
<weaksauce> it's the original style of hash creation before the symbol shorthand
<adam12> component = 'foo'; branch = 'bar'; {component => branch}.to_json # => {'foo': 'bar'}
<weaksauce> where any object could be a key
some14u has joined #ruby
rawley has quit [Ping timeout: 272 seconds]
<mooff> :: foo = ['a', 'b']; [{foo => 'hi'}, {foo: 'there'}]
<ruby-eval> => [{["a", "b"]=>"hi"}, {:foo=>"there"}]
duds- has quit [Ping timeout: 260 seconds]
<arosen> okay thank you.
rawley has joined #ruby
duds- has joined #ruby
___nick___ has quit [Ping timeout: 272 seconds]
trillp has joined #ruby
ur5us_ has joined #ruby
duds- has quit [Ping timeout: 272 seconds]
duds- has joined #ruby
eddof13 has joined #ruby
fowl has quit [Quit: cya pals]
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fowl has joined #ruby
markong has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
dionysus69 has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nmollerup has joined #ruby
eddof13 has joined #ruby
trillp has quit [Quit: Textual IRC Client: www.textualapp.com]
d-s|pl has joined #ruby
d-s has quit [Ping timeout: 250 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rawley has quit [Remote host closed the connection]
eddof13 has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
emcb58 has joined #ruby
emcb5 has quit [Ping timeout: 240 seconds]
emcb58 is now known as emcb5
d-s|pl has quit [Remote host closed the connection]
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
aeris has quit [Ping timeout: 240 seconds]
_aeris_ has joined #ruby
_aeris_ is now known as aeris
ur5us_ has quit [Ping timeout: 250 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
markong has quit [Ping timeout: 260 seconds]
Cork has quit [Ping timeout: 272 seconds]
Cork has joined #ruby
arosen has quit [Quit: Leaving.]
John_Ivan has quit [Quit: Leaving]
donofrio has joined #ruby