<_phaul>
no I can't.. I will look into it, hopefully will come out with some understanding. Give me a break... It's 00:10 I watched friends all day on lockdown... And Ross has just broken up with Rachel
<al2o3-cr>
haha, no problem _phaul. shit, i watched that back in the 90's lol :P
zlogan has quit [Ping timeout: 246 seconds]
darkstardevx has joined #ruby
<al2o3-cr>
i had thing for lisa kudrow back then :P
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
NightMonkey has joined #ruby
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
drincruz_ has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
drincruz_ has quit [Ping timeout: 250 seconds]
cschneid has quit [Ping timeout: 256 seconds]
cschneid_ has joined #ruby
_whitelogger has joined #ruby
TzilTzal has joined #ruby
orbyt_ has joined #ruby
<TzilTzal>
Hi
<TzilTzal>
Does anyone know whether it's possible to create Settinglogic from a string/hash? and not from a file? It seems as thought from a hash it's possible but I keep getting errors.
d3bug has quit [Quit: Connection closed for inactivity]
kristian_on_linu has joined #ruby
<havenwood>
TzilTzal: What's a Settinglogic?
<havenwood>
TzilTzal: Show the errors?
kristian_on_linu has quit [Remote host closed the connection]
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
dinfuehr has quit [Ping timeout: 264 seconds]
dStromboli has joined #ruby
dinfuehr has joined #ruby
markopasha has joined #ruby
comet23 has joined #ruby
drincruz_ has joined #ruby
polishdub has quit [Quit: leaving]
jetchisel has joined #ruby
drincruz_ has quit [Ping timeout: 246 seconds]
cschneid has joined #ruby
cschneid_ has quit [Ping timeout: 250 seconds]
roadie has joined #ruby
dStromboli has quit [Ping timeout: 250 seconds]
alexherbo2 has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tsujp has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
markopasha has quit [Ping timeout: 246 seconds]
bvdw has quit [Read error: Connection reset by peer]
<xco>
al2o3-cr xco: make an install message for your gem ;) << by that you meant a post install message? :D
bvdw has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
ur5us has joined #ruby
hiroaki has quit [Ping timeout: 240 seconds]
<pyrmont>
TzilTzal: The docs for that gem now live at https://rdoc.info/github/settingslogic/settingslogic/. The constructor in the docs for Settingslogic indicates it's possible to create from a hash. If you do that, the value of the instance of Settingslogic is replaced with the contents of the hash.
<TzilTzal>
pyrmont: I know it indicates that.. but when I pass in a hash, I keep getting errors trying to access the structure through members named based on the keys
<pyrmont>
Can you paste the code and errors as a gist?
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
william1_ has joined #ruby
iNs has quit [Remote host closed the connection]
iNs_ has joined #ruby
william1_ has quit [Ping timeout: 250 seconds]
schne1der has joined #ruby
drincruz_ has joined #ruby
drincruz_ has quit [Ping timeout: 258 seconds]
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
alfiemax has joined #ruby
<_phaul>
al2o3-cr: reading back.. now I get it. But it's pretty much WTF
<_phaul>
and then it changes back: -2.**(2) is again -2 constant literal
<Gestahlt>
Hi, i have a question about rails tho - I use Rails 6 with a new app i write, now i want to dynamically create routes based on a configuration file (and also some more stuff). I assume i have to execute the code after startup of the rails server
<Gestahlt>
Well, the funny thing is, i logged the rails startup and see that the class i want to instanciate is loaded (app/lib/klass.rb) but when i call it, it says undefined constant
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
<Gestahlt>
when i call it in the console tho, it works, so it is unavailable in config/application.rb (While it is clearly shown with Rails.autoloaders.log! that it is loaded), but i cannot call it from the autoloaders.rb
<Gestahlt>
Arrr
cschneid_ has joined #ruby
cschneid has quit [Ping timeout: 240 seconds]
chalkmonster has joined #ruby
chalkmonster has quit [Client Quit]
comet23 has quit [Quit: Connection closed for inactivity]
TomyWork has joined #ruby
william1_ has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
burningserenity has quit [Ping timeout: 240 seconds]
GodFather has quit [Ping timeout: 265 seconds]
<nyuszika7h>
ah, got it, it's a missing index
<nyuszika7h>
in the referenced table
jingjinghack has quit [Quit: WeeChat 2.1]
conta has joined #ruby
cschneid has joined #ruby
cschneid_ has quit [Ping timeout: 264 seconds]
burningserenity has joined #ruby
_phaul has joined #ruby
phaul has quit [Ping timeout: 250 seconds]
alfiemax has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
pupsikov has joined #ruby
caterfxo has joined #ruby
jacksop has joined #ruby
vondruch has joined #ruby
vondruch has quit [Client Quit]
noboruma has joined #ruby
fluxAeon has quit [Ping timeout: 250 seconds]
leitz has joined #ruby
fluxAeon has joined #ruby
vondruch has joined #ruby
GodFather has joined #ruby
jacksop has quit [Ping timeout: 240 seconds]
conta has quit [Quit: conta]
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
<leitz>
Has anyone done the Ruby certification exam?
jacksop has joined #ruby
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
ellcs has joined #ruby
jacksop has quit [Remote host closed the connection]
cranq has joined #ruby
d3bug has joined #ruby
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
yxhuvud has joined #ruby
lucasb has joined #ruby
ChmEarl has joined #ruby
MrCrackPot has quit [Quit: Leaving]
<havenwood>
leitz: I did the practice questions, which were kinda fun. I haven't actually taken it, but I remember being interested a while back that they were adding a harder level.
phaul has joined #ruby
<havenwood>
hramrach: You can call #captures on the Matchdata.
<havenwood>
hramrach: Consider using named captures.
_phaul has quit [Ping timeout: 250 seconds]
<havenwood>
&>> "numbers: one two three # we don't need more numbers defined here".match(/(?<type>^[^:]+):(?<amount>[ \t]*[^# \t]+)*/).named_captures
<havenwood>
hramrach: Ohhh, I misunderstood your question. Got it now.
caterfxo is now known as itried
itried has quit [Quit: leaving]
caterfxo has joined #ruby
brendan- has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
<leitz>
havenwood, they have a Silver and Gold, and the page references Platinum. I figure it'd be useful as an outline to make sure my skills are decently rounded.
cschneid_ has joined #ruby
cschneid has quit [Ping timeout: 256 seconds]
<leitz>
havenwood, I have actually seen job reqs that want a language certification. Didn't care what, just something. The options are limited: Java, PHP, SQL. Not too many others.
chalkmonster has quit [Quit: WeeChat 2.7.1]
<apotheon>
leitz: If I *had* to get a language cert and it didn't matter which, and my choices were Java, PHP, Ruby, and SQL, I would definitely go for Ruby.
davor has quit [Ping timeout: 264 seconds]
<apotheon>
. . . just for the sake of not being as annoyed by the cert.
davor has joined #ruby
chalkmonster has joined #ruby
<leitz>
apotheon, it gets worse! The Software Engineering certificate is based on Java 5, IIUC. Pretty funny.
<apotheon>
lovely
<apotheon>
I should establish a Lambda Calculus language certification.
<leitz>
But yeah, Ruby is my choice to go from Apprentice to Journeyman, and using the "focus on getting the cert" should help with the process.
<leitz>
If you can establish a great training methodology, it would probably work.
_phaul has joined #ruby
phaul has quit [Ping timeout: 258 seconds]
fercell has quit [Remote host closed the connection]
<apotheon>
I think perhaps the best approach to lambda calculus for the casual autodidact and, thus, for a formal training program, would start with implementing a lambda calculus parser (with a few enhancements, perhaps, kinda like how Perl's regexen aren't proper "regular expressions"), then write various pieces of software with it.
fercell has joined #ruby
* leitz
reminds apotheon that Ruby is great for building DSLs...
<havenwood>
hramrach: I think a solution is doable with #match and \G. Lemme think.
chalkmonster has quit [Quit: WeeChat 2.7.1]
<apotheon>
leitz: Ruby is the only place I've implemented a lambda calculus parser.
phaul has joined #ruby
<apotheon>
I should probably try it in SML, too, some day. I think that would mostly consist of . . . not using a lot of the language.
<apotheon>
Oh, shit, that means I've already implemented it.
cschneid has joined #ruby
* leitz
reminds apotheon that the "Ruby Weekly" e-mail from Peter Cooper would be a great place to send an article about implementing a lambda calculus parser in Ruby.
_phaul has quit [Ping timeout: 256 seconds]
<apotheon>
There's already a book that addresses that kind of thing, so my commentary would be redundant.
<apotheon>
q.v. Understanding Computation
<leitz>
apotheon, what book?
<apotheon>
O'Reilly
<leitz>
apotheon, that mean I can ask you questions when I dive into the book?
cow[moo] has joined #ruby
phaul has quit [Ping timeout: 250 seconds]
<apotheon>
leitz: You may always ask. I'm not sure I'll remember much about it.
<leitz>
Thanks! I'm going to focus on the cert first, that should take me a bit. Not sure when life will return to normal.
phaul has joined #ruby
<apotheon>
righto
DTZUZU2 is now known as DTZUZU
<leitz>
I want to get my Ruby skills to a better level. It'll help my job search, and projects.
TCZ has joined #ruby
TreeAr has joined #ruby
<apotheon>
leitz: You'll be coding circles around me in no time.
phaul has quit [Ping timeout: 264 seconds]
orbyt_ has joined #ruby
phaul has joined #ruby
cthu| has joined #ruby
<leitz>
apotheon, I've been coding myself in circles for years; that's what I'm trying to fix. :)
ellcs has quit [Ping timeout: 246 seconds]
<apotheon>
nice
ellcs has joined #ruby
cloaked1 has joined #ruby
burningserenity has quit [Remote host closed the connection]
burningserenity has joined #ruby
fercell has quit [Ping timeout: 256 seconds]
_phaul has joined #ruby
SeepingN has joined #ruby
phaul has quit [Ping timeout: 246 seconds]
Emmanuel_Chanel has quit [Ping timeout: 256 seconds]
burningserenity has quit [Ping timeout: 240 seconds]
Emmanuel_Chanel has joined #ruby
roadie has quit [Read error: Connection reset by peer]
TomyWork has quit [Remote host closed the connection]
roadie has joined #ruby
phaul has joined #ruby
TomyWork has joined #ruby
clemens3 has quit [Quit: laterz]
<xco>
does Ruby happen to have something in-built to parse reformat dates or I'll have to fallback on Rails' AS methods? For example I want a date like this "3/12/20" to be be "March 12, 2020"
burningserenity has joined #ruby
TomyWork has quit [Remote host closed the connection]
_phaul has quit [Ping timeout: 250 seconds]
<leitz>
xco, do Date or DateTime have what you need?
<xco>
nope
<xco>
just check
<xco>
checked*
<xco>
but i'm seeing Date.strptime maybe i could work with it
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
Xiti has quit [Read error: Connection reset by peer]
Xiti has joined #ruby
<havenwood>
hramrach: Hrm, this works on rubular but not in Ruby. I suspect it's doable with \G or \g subexpressions, but I need coffee... https://rubular.com/r/vpZ3Olwoom6xOc
<havenwood>
I've wanted to use the experimental (?~subexpression) but haven't had a chance.
<havenwood>
(?:(?!subexpression).)*
<havenwood>
Anyone know why rubular disagrees with Ruby there ^?
ferche23 has quit [Ping timeout: 250 seconds]
schne1der has quit [Ping timeout: 265 seconds]
<havenwood>
&>> 'numbers: one two three # en fin'[/(?<=:)(.*?)#/].scan(/[^# \t]+/)
<havenwood>
xco: Then shovel an empty string on each.
dinfuehr has quit [Ping timeout: 256 seconds]
chalkmonster has joined #ruby
<havenwood>
xco: I replied to your gist.
ellcs has quit [Ping timeout: 246 seconds]
<xco>
thank you :)
chalkmonster has quit [Client Quit]
<havenwood>
yw
ShekharReddy has joined #ruby
dinfuehr has joined #ruby
<havenwood>
xco: Just curious, by why the empty string? What's that for?
<xco>
i'll put something there :)
<xco>
another string
code_zombie has joined #ruby
<phaul_>
can we guess? is it "title" ? :D
<xco>
hahaha now
<xco>
i'll ask for a review a few minutes
<xco>
:D :D
<xco>
so you'll know what i'm on to
dinfuehr_ has joined #ruby
dinfuehr has quit [Ping timeout: 240 seconds]
cranq has quit [Remote host closed the connection]
hiroaki has joined #ruby
dinfuehr has joined #ruby
sysh has joined #ruby
dinfuehr_ has quit [Ping timeout: 264 seconds]
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
cranq has joined #ruby
ellcs has joined #ruby
fercell has quit [Quit: WeeChat 2.7.1]
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
cschneid_ has quit [Ping timeout: 256 seconds]
cschneid has joined #ruby
dinfuehr has quit [Ping timeout: 256 seconds]
dinfuehr has joined #ruby
ur5us has joined #ruby
conta has quit [Quit: conta]
Frobozz has joined #ruby
dinfuehr has quit [Ping timeout: 264 seconds]
dinfuehr has joined #ruby
cnsvc has joined #ruby
ShekharReddy has quit []
<hramrach>
havenwood: the available documentations states it's not posible. In your example you preserve one, two, and three and lose numbers
<apotheon>
havenwood: Is there an updated equivalent to interactive_editor?
<hramrach>
so anyway it's possible to do with two consecutive less complex regular expressions which is what I am using
alexherbo2 has quit [Ping timeout: 240 seconds]
<havenwood>
hramrach: My example isn't right, but I do think it's possible with Ruby Regexp.
<havenwood>
hramrach: Lemme try to find an example.
<havenwood>
hramrach: I was multitasking and hoping my wild stab would trigger someone else to answer.
<hramrach>
&>> caption, content = 'numbers: one two three # en fin'.match(/(^[^:]+):((?:[ \t]*[^# \t]+)*)/).captures ; [caption, *flags.strip.split(/\s/)]
<rubydoc>
stderr: -e:4:in `<main>': undefined local variable or method `flags' for main:Object (NameError)... check link for more (https://carc.in/#/r/8rci)
<hramrach>
&>> caption, content = 'numbers: one two three # en fin'.match(/(^[^:]+):((?:[ \t]*[^# \t]+)*)/).captures ; [caption, *content.strip.split(/\s/)]
<hramrach>
the thing is it's not overly useful if it's possible but not really readable
<hramrach>
it is just unexpected limitation of matchdata that the interface cannot handle repeat groups
<hramrach>
but with this limitation you cannot get the matches and there is easy workaround, too
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
dinfuehr_ has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
dinfuehr_ has quit [Ping timeout: 250 seconds]
ferche23 has quit [Ping timeout: 256 seconds]
pupsikov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
hramrach: I'm not finding a \g subexpression or \G anchor example that works for your case, like I hoped. Are you using the #match return value other than for the captures? A #scan alone seems doable. For example, this Rubular from SO with #scan: https://rubular.com/r/jOJRhwJvR4
<havenwood>
hramrach: Is this a tight look that you need to optimize, or is readability more important?
<robotcars>
those return the same, but reject is preffered?
<leftylink>
interesting choice by rubocop. I see no reason to prefer either one over the other
dinfuehr has quit [Ping timeout: 256 seconds]
<apotheon>
I'd prefer the reject option because it requires fewer keypresses.
<robotcars>
lol
<apotheon>
They're identical in terms of keypresses except != is three keypresses and == is only two, with the bonus that they're both the same key.
schne1der has joined #ruby
<phaul_>
it's a bit like if not vs unless. moves the negation into the verb, so more human readable.
d3bug has quit [Quit: Connection closed for inactivity]
<apotheon>
Yes, I do use vi. Why do you ask?
<hramrach>
havenwood: the heavy lifting happens in system(). The parsing is not really performance critical
<apotheon>
phaul_: That too.
<robotcars>
thanks leftylink, the logic seemed sound, and the first way is more readable for what i'm doing
<apotheon>
(Actually, phaul_ has a better reason than mine, but I like mine too.)
dinfuehr has joined #ruby
<hramrach>
and the rubular example with scan does not return variable number of groups, either
d3bug has joined #ruby
<hramrach>
can can do variable number of matches of the whole expression but not of subexpression
<havenwood>
hramrach: It returns left and rights, so one more parsing stage.
<havenwood>
hramrach: I think a more straightforward approach is better, since it's not performance critical. Sec.
<hramrach>
oh, right. this does not even process results, it only reads a file with ~50 lines of this stuff
howdoi has quit []
howdoi has joined #ruby
dinfuehr has quit [Ping timeout: 256 seconds]
sysh has quit [Remote host closed the connection]
<hramrach>
it would be interesting inconsistency if match returned the repeat groups but I would expect it uses the same underlying engine and hence same result representation
<hramrach>
so 'then' passes list as block arguments
dinfuehr has joined #ruby
evdubs has quit [Remote host closed the connection]
evdubs has joined #ruby
<hramrach>
&>> 'numbers: one two three # en fin'.match(/(^[^:]+):((?:[ \t]*[^# \t]+)*)/).captures.then{|caption, content| [caption, *content.strip.split(/\s/)]}
<havenwood>
xco: I'd then extract a constant. There are a few places I'd still extract constants. It actually increases readability, reduces memory, and is faster too. :)
<xco>
too tired to even copy and paste but will be done in next version tomorrow
<havenwood>
:)
<xco>
yeah you mentioned those
<xco>
in time all those will be done
cloaked1 has quit [Ping timeout: 250 seconds]
<havenwood>
xco: Looks like COUNTRY_OUTCOMES is used a few places.
<havenwood>
That makes for a nice constant.
<havenwood>
And constants can build on each other. That's fine.
<havenwood>
xco: That said, the local variable assignment is cheap, so not a big deal.
<xco>
makes sense :)
<xco>
noted
<havenwood>
xco: I wonder about persisting the cache to disk. It only works for the duration of each command at the moment, since it's in process memory.
<xco>
that i know
<xco>
but if you persist to a disc
<xco>
what's the points?
<xco>
it'll expire
<xco>
and you'll have ot fetch again
roadie has joined #ruby
<xco>
the expiry time is 15min
<havenwood>
xco: It'd just be if you say wanted to compare various countries, to not repeatedly fetch them.
<havenwood>
Disk access is way faster than web, but probably doesn't matter. Just made me wonder since you had a cache.
<havenwood>
Often HTTP calls are cached to disk or something persistent.
<xco>
you know what i could use that disc cache for?
<xco>
for a new feature "new cases since you last visited"
<xco>
been thinking about that
schne1der has quit [Ping timeout: 240 seconds]
<havenwood>
xco: that's a good use
<xco>
that's the next feature i'd like to work on
<xco>
that'd mean i'll have to write to a file instead
<xco>
of using a memory cache though
<xco>
i'd want to**
<havenwood>
xco: You could use PStore or YAML::Store for "a file based persistence mechanism based on a Hash."
<havenwood>
"The transactional behavior ensures that any changes succeed or fail together. This can be used to ensure that the data store is not left in a transitory state, where some values were updated but others were not."
<havenwood>
xco: Or YAML::DBM, if you want a very lightweight DB that operates on the same principles.