<repo>
i'm thinking about maybe adding one for x-www-form-urlencoded
<FromGitter>
<Blacksmoke16> and like check if the provided string is your format, otherwise just call `previous_def` or something
<repo>
right
<repo>
but i could fork :P
<FromGitter>
<Blacksmoke16> never really thought of that being a serialization format before
<FromGitter>
<Blacksmoke16> suppose it is tho
<repo>
:)
<repo>
i mean it's fairly common to have forms sent in this format
<repo>
and it'd be pretty awesome to be able to define one model, that would work in an api as well as in a "classic" web app
<FromGitter>
<Blacksmoke16> yea for sure. i wouldnt be opposed to including that in the core shard
Human_G33k has quit [Quit: Leaving]
HumanG33k has joined #crystal-lang
deavmi_ has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<FromGitter>
<mixflame> is there a crystal multilingual badwords filter shard? is there a shard that allows parsing links out of a string as well?
<FromGitter>
<mixflame> i want to extract all the links from a string and then do some parsing on them to check the domain, and i also want as many bad words filtered as possible
<FromGitter>
<dscottboggs_gitlab> the stdlib has `URI.parse`, would that work?
<FromGitter>
<mixflame> that will work once the URL's are regexed or removed from the string
<FromGitter>
<mixflame> the string could have multiple urls in it
<FromGitter>
<j8r> how bad?
<FromGitter>
<mixflame> anything a 4 year old cant handle
<FromGitter>
<Blacksmoke16> sounds like a pita
<FromGitter>
<mixflame> apple requirements to launch my app
<FromGitter>
<mixflame> 1) Require that users agree to terms (EULA) and these terms must make it clear that there is no tolerance for objectionable content or abusive users ⏎ 2) A method for filtering objectionable content ⏎ 3) A mechanism for users to flag objectionable content ⏎ 4) A mechanism for users to block abusive users ⏎ 5) The developer must act on objectionable content reports within 24 hours by removing the
<oprypin>
so in C you can just write `static int foo = 0` anywhere in a function. it's an init-once global that's accessible only locally... what would the closest equivalent be in crystal?
<FromGitter>
<Blacksmoke16> prob just a local variable in the method
<FromGitter>
<Blacksmoke16> :shrug:
<oprypin>
no but it's persistent
<FromGitter>
<dscottboggs_gitlab> pretty sure that's not a thing in Crystal
<FromGitter>
<dscottboggs_gitlab> yeah, not the same thing @Blacksmoke16
<FromGitter>
<dscottboggs_gitlab> the closest we'd have is something namespaced to a module with `class_property foo : Int32 { 0 }`
<FromGitter>
<dscottboggs_gitlab> you could just do `static y : Int32 = 4` though
<FromGitter>
<Blacksmoke16> `static`? :thinking:
<oprypin>
Error: declaring the type of a class variable must be done at the class level
<FromGitter>
<dscottboggs_gitlab> also, again, this is just a `class_property` with a block, and leaks to the surrounding scope
<oprypin>
egh i'm just looking for proximity to surrounding code (yes, horrible)
<FromGitter>
<dscottboggs_gitlab> TBH I wouldn't mind seeing how a feature request for this would go over
<oprypin>
LOL
<oprypin>
to have a good laugh, or something
<FromGitter>
<dscottboggs_gitlab> yeah true, I don't think I've ever had a feature request go over well...
<FromGitter>
<RespiteSage> Is the C `static int` mutable?
<oprypin>
RespiteSage, yes
<FromGitter>
<RespiteSage> Huh. I'm looking at how it behaves now, and it's very strange.
<oprypin>
it's literally just a global variable *but* it's accessible only inside the function and also enjoys the benefit of being located with the rest of the function body
<FromGitter>
<RespiteSage> Yeah. I guess that's a bit safer than true globals...
<oprypin>
writing `static int x = 5` is nothing like `int x = 5`, the definition is kinda yanked at very early stages of the compilation, and behaves as if you wrote `int x = 5` at the top of the program instead
<FromGitter>
<RespiteSage> So for `static int x=5; x-=1`, two runs of the containing method would leave `x` equal to 3?
<FromGitter>
<RespiteSage> *`x--`.
<oprypin>
ye
<FromGitter>
<RespiteSage> Yeah, I'm struggling as well to come up with a way to do that in Crystal.
<FromGitter>
<RespiteSage> I just meant in the readme.
<FromGitter>
<mixflame> yup np I did it
<FromGitter>
<RespiteSage> Cool. That was a quick turnaround, though.
<FromGitter>
<mixflame> I just lead back to the original readme because I left the api the same
<FromGitter>
<dscottboggs_gitlab> I'm sure that you just copied the original `blacklist.yml` from the original gem, but I find it weird to use YAML to represent a flat list of strings. Why not just newline-separate them and do `File.open "blacklist", &.each_line.to_a`?
<FromGitter>
<mixflame> that's right I copied what they had. they were doing ```YAML.load_file``` which loads it directly to an array, which Crystal doesn't have
<FromGitter>
<dscottboggs_gitlab> yeah, I'll do a PR to switch to NDL if you wouldn't mind
<FromGitter>
<dscottboggs_gitlab> Idk I'm pretty opinionated about stuff that I know doesn't matter and it's hard to know when something I'm saying is just an inconsequential opinion vs something worth submitting a PR over
<FromGitter>
<mixflame> true
zorp_ has quit [Ping timeout: 265 seconds]
<FromGitter>
<mixflame> I'm successfully using the Obscenity port in my Crystal server. Just to let you guys know.
<FromGitter>
<alexherbo2> why does crystal does not support `private` / `protected` declarations?