ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
wwalker has joined #crystal-lang
<wwalker> Looking for an ORM recommendation. I did some looking and ended up at Granite, but it's README starts with "Looking for Maintainers"... I only need the simplest of ORMs, but with sqlite support. I might not even need an ORM.
<FromGitter> <Blacksmoke16> https://crystal-lang.github.io/crystal-db/api/0.11.0/DB/Serializable.html works quite well. You would need to handle insert/updates yourself. But that can be fairly easily abstracted into a method
notzmv has quit [Ping timeout: 250 seconds]
Sankalp has quit [Ping timeout: 276 seconds]
Sankalp has joined #crystal-lang
notzmv has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
debayer has joined #crystal-lang
<FromGitter> <naqvis> > Dumb, quick question: anyone know of a relatively loose date/time string parser that allows a whole lot of common patterns? Like `2022-05-02 06:07:08` and `5/2/2022 6pm` and such? ⏎ ⏎ you can use `Time::Format` with some extra cleanup to try parse String to `Time` ⏎ https://carc.in/#/r/d4wj [https://gitter.im/crystal-lang/crystal?at=6274cfaf46495f47cfc9a46e]
analogsalad has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
jmdaemon has quit [Ping timeout: 248 seconds]
analogsalad has quit [Quit: bye]
debayer has quit [Quit: if you can't play with it, why bother?]
analogsalad has joined #crystal-lang
analogsalad has quit [Quit: bye]
ua_ has quit [Excess Flood]
ua_ has joined #crystal-lang
SamantazFox has quit [Ping timeout: 248 seconds]
jrayhawk has quit [Ping timeout: 252 seconds]
jrayhawk has joined #crystal-lang
<FromGitter> <plambert> > > Dumb, quick question: anyone know of a relatively loose date/time string parser that allows a whole lot of common patterns? Like `2022-05-02 06:07:08` and `5/2/2022 6pm` and such? ⏎ > ⏎ > you can use `Time::Format` with some extra cleanup to try parse String to `Time` ⏎ > https://carc.in/#/r/d4wj ⏎ ... [https://gitter.im/crystal-lang/crystal?at=62755f32cd938f6ea233fac4]
notzmv has quit [Ping timeout: 248 seconds]
jmdaemon has joined #crystal-lang
SamantazFox has joined #crystal-lang
notzmv has joined #crystal-lang
ur5us has joined #crystal-lang
analogsalad has joined #crystal-lang
analogsalad has quit [Client Quit]
<wwalker> if I have multiple source files to build a single binary, what does my shard.yml targets section look like?
Guest86 has joined #crystal-lang
<FromGitter> <Blacksmoke16> youd prob require all the required files within 1 file and use that as your target in `shard.yml`
<wwalker> Every example I see has main: src/main.cr
<FromGitter> <Blacksmoke16> i.e. you dont specify all your source files as targets
<wwalker> Blacksmoke16: thank you.
<FromGitter> <Blacksmoke16> yea, look in that file and you'll see like: ⏎ ⏎ ```require "..." ⏎ require "..." ⏎ ...``` [https://gitter.im/crystal-lang/crystal?at=62759f5789dcc96e9ced401e]
Guest86 has quit [Quit: Client closed]
<FromGitter> <plambert> Can I do string manipulation inside a macro?
<FromGitter> <plambert> For example, the equivalent of `"foo".gsub(/o/) {|m| "x"}`
<FromGitter> <Blacksmoke16> yes, but depends on what exactly you want to do id say, as it only has a subset of the API
<FromGitter> <plambert> Specifically, I am defining classes, and want to define methods with the class names changed from `FooBarBaz` to `foo_bar_baz`
<FromGitter> <Blacksmoke16> `{{ pp "foo".gsub /o/, "x" }}`
<FromGitter> <Blacksmoke16> `.underscore`?
<FromGitter> <plambert> Wow! Thanks. :)
<FromGitter> <plambert> I never thought to search for that. :)
<FromGitter> <plambert> OK, while I'm here, a question I've had for a while…
<FromGitter> <plambert> I'd love to be able to create a macro that defines a class
<FromGitter> <plambert> But also adds it to a list, and later populate a case statement and an enum
<FromGitter> <plambert> I think this is possible, and if it's possible, it's surely been done... so if anyone has an idea where I might find an example to look at and learn from, I'd love to know!
<FromGitter> <Blacksmoke16> im sure its possible
<FromGitter> <Blacksmoke16> can you put together a quick playground link of what you want to do and what it should generate?
<FromGitter> <Blacksmoke16> can prob fill in the blanks from ther
<FromGitter> <plambert> playground link?
<FromGitter> <plambert> the play.crystal-lang.org site?
<FromGitter> <Blacksmoke16> yea
<FromGitter> <plambert> This is what I'd like to write: https://play.crystal-lang.org/#/r/d51a
<FromGitter> <plambert> This is what I'd like to to effectively generate: https://play.crystal-lang.org/#/r/d51c
<FromGitter> <plambert> Just trying to get rid of boilerplate, and reduce the amount of info I have to put in to the smallest I can…
<FromGitter> <plambert> (None of that works, of course… it's just example code…)
<FromGitter> <Blacksmoke16> Kk, let me take a look
<FromGitter> <Blacksmoke16> i have an idea
ur5us has quit [Ping timeout: 250 seconds]
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/d51j
<FromGitter> <Blacksmoke16> hows that?
<FromGitter> <Blacksmoke16> tho few things worth pointing out, im assuming `text` is actually a `Token::Type` member?
<FromGitter> <Blacksmoke16> if so you can use `in` instead of `when` in your `case`