<FromGitter>
<iambudi> is possible to call class a propery by string, for example i have many class property name but i want to get only few. Something like : ⏎ ```[“name”,”age”].each {|v| puts @v }```
<FromGitter>
<iambudi> @v refer to instance variable
<FromGitter>
<Blacksmoke16> would have to use a macro
<FromGitter>
<iambudi> yes solved using macro, i thougt there were another solution
<FromGitter>
<Blacksmoke16> not by default no, would have to make something on your own
thews has quit [Ping timeout: 240 seconds]
Renich has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
<FromGitter>
<dscottboggs_gitlab> what gives? https://carc.in/#/r/5mdn shouldn't this fall under number 2?
<FromGitter>
<Blacksmoke16> prob because `Session` isnt defined?
<FromGitter>
<dscottboggs_gitlab> oh, sorry
<FromGitter>
<dscottboggs_gitlab> yeah that's I think, it's not picking up that Session is defined, not a very helpful error haha
<FromGitter>
<iambudi> how to add to an array inside hash? ⏎ ```hash[“array”] = [“one”, “two”]``` ⏎ ```hash[“array”] << “three”``` seems does not work
<FromGitter>
<Blacksmoke16> not sure what *that* error is saying, but the issue you're prob having is defining the type of the has as `String | Array(String)`
<FromGitter>
<Blacksmoke16> there is no `<<` method for `String` so you'll have to check the type of what the hash is before adding to it
<FromGitter>
<iambudi> hash.class or typeof(hash) returns Hash(String, Array(String) | String)
<FromGitter>
<iambudi> kind of wierd, it works in the online playground but not in my local
<FromGitter>
<Blacksmoke16> check character encoding of your file
<FromGitter>
<Blacksmoke16> might not be UTF-8, based on your quotes
<FromGitter>
<iambudi> nope i can confirm using your code .as(Array(String) works on my local but not work without it
<FromGitter>
<Blacksmoke16> well yea, without that there is no << method for String so it would fail
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
<FromGitter>
<iambudi> thanks
<FromGitter>
<iambudi> > without raising an exception: https://carc.in/#/r/5mee ⏎ ⏎ I did not know if crystal can do inline assignment in if condition
sp3ncer has quit [Read error: Connection reset by peer]
sp3ncer has joined #crystal-lang
Renich has left #crystal-lang [#crystal-lang]
Renich has joined #crystal-lang
<FromGitter>
<dscottboggs_gitlab> > inline assignment in if condition ⏎ ⏎ so the interesting thing is that this just comes from the fact that every statement returns a value implicitly. The `=` assignments return the value assigned, and so you can do stuff on the returned value of the assignment
Groogy has quit [Read error: Connection reset by peer]
_whitelogger has joined #crystal-lang
Renich has quit [Ping timeout: 240 seconds]
Renich has joined #crystal-lang
Renich has quit [Remote host closed the connection]
<FromGitter>
<Qard> Hey, I'm working on an API that needs to be able to take a proc with whatever arbitrary parameters and call it using items in an array as the arguments. Is there some way to make that work? I'm having trouble figuring out if there's a way to work within the type system to support that generically. I tried doing `Tuple.from(...)` on the array to work with the spread feature, but that expects type information to be
<FromGitter>
... given explicitly. Any ideas?
Groogy has joined #crystal-lang
<FromGitter>
<r00ster91> does somebody know what the first line in a `shard.lock` stand for? ⏎ "version: 1.0"
<FromGitter>
<bararchy> @Qard Maybe let us know what is the incoming data structure and what is the outgoing one
<FromGitter>
<bararchy> As in, show me what the data incoming looks like and how you want it out
ua has joined #crystal-lang
ua_ has quit [Ping timeout: 240 seconds]
thews has joined #crystal-lang
Groogy has quit [Quit: WeeChat 2.3]
Groogy has joined #crystal-lang
<FromGitter>
<Val> @veelenga : could *codacy-ameba* be used without *docker* , more like *ameba* does ?
<FromGitter>
<Val> I see it's a starting project, but I just wanted to know if it's planed =)
<FromGitter>
<bararchy> but it works really nice, I like how json like it feels, but I would love to have `--target http://www.com` instead of `target=https:....etc..`
<FromGitter>
<j8r> I really need to find a way to align help commands without having to manually add `\t` :/
gangstacat has joined #crystal-lang
<FromGitter>
<Blacksmoke16> figure out longest word, add 2 spaces, then add `longest world + 2 - length of other words`
<FromGitter>
<j8r> hum so I need to have 2 pass operations
<FromGitter>
<bararchy> @j8r .max_by .size ?
<FromGitter>
<j8r> the tricky thing is this is only macros, but it might be possible with a macro variable
<FromGitter>
<jamesreckon> I have come up a new idea about getting Crystal demo in one place to encourage newbies and experience developers to try any Crystal code in repo without friction or having to search everywhere. Hence, I like to encourage Crystal folks to contribute your code demo to showcase any features which can be related to your or other author’s shards: ⏎ ⏎ https://github.c
<FromGitter>
<dscottboggs_gitlab> > does somebody know what the first line in a `shard.lock` stand for? ⏎ ⏎ That's the version of your project, so that shards can use semver to manage dependencies if other projects use yours as a dependency
<FromGitter>
<dscottboggs_gitlab> @r00ster91
<FromGitter>
<dscottboggs_gitlab> I'm trying to test a websocket connection, does anyone know how to do that? https://carc.in/#/r/5mh0
<FromGitter>
<veelenga> well, this is just an app that implements integration with codacy. Once i finish it/submit for review and codacy accepts it, you will be able just to use ameba via codacy UI.
<FromGitter>
<Val> Ok my bad, it's an analysis engine.
<FromGitter>
<Val> I'll try it =)
Renich has joined #crystal-lang
<FromGitter>
<vladfaust> UUIDs docs are overwritten by `crystal/src/uuid/json.cr`: https://crystal-lang.org/api/0.27.0/UUID.html. I guess it's a common issue for monkey-patched objects. cc @RX14
<RX14>
yeah
<RX14>
thats just wrong
<FromGitter>
<drum445> @Blacksmoke16 @j8r thanks again guys for the nginx advice, was much nicer to setup than apache and so far it's working like a charm with a few go/crystal apps :)
<livcd>
when do you guys see windows support being released ?
sp3ncer has joined #crystal-lang
<FromGitter>
<Blacksmoke16> np
sp3ncer has quit [Read error: Connection reset by peer]
sp3ncer has joined #crystal-lang
<FromGitter>
<dscottboggs_gitlab> @livcd check out issue #5430
akaiiro has joined #crystal-lang
Groogy has quit [Quit: WeeChat 2.3]
sp3ncer has quit [Read error: Connection reset by peer]
<FromGitter>
<greenbigfrog> I've got a class which is more or less just a JSON.mapping ⏎ I'd like to access the data via a `String` ⏎ More or less like rubys `Object#send`, except I only want to call a getter instead of an actual function ⏎ ⏎ Is this possible? [https://gitter.im/crystal-lang/crystal?at=5bfb1383cfa682348d835485]
<FromGitter>
<dscottboggs_gitlab> I'm not familiar with Ruby, what does `Object#send` do?
<FromGitter>
<dscottboggs_gitlab> @greenbigfrog you're right, that would be nice to be able to do and I don't know if there is a way to do it in crystal
<FromGitter>
<j8r> this can't be done with crystal
<FromGitter>
<dscottboggs_gitlab> like if you could access data via `a.__attr__["data"]` or something but I think that is not possible due to being compiled
<FromGitter>
<j8r> crystal is statically typed, everything has to be known at compile time
<FromGitter>
<j8r> you can use case/when to match string and perform and action
<FromGitter>
<greenbigfrog> is there no way at all? `SomeData` would be created once and not altered afterwards
<FromGitter>
<dscottboggs_gitlab> @greenbigfrog I have an idea just a minute
<FromGitter>
<j8r> a string can't be transformed to a method call magically
<FromGitter>
<j8r> this is runtime interpretation, and crystal isn't interpreted
<FromGitter>
<greenbigfrog> hm. ok
<FromGitter>
<j8r> you can use a case/when
sp3ncer has joined #crystal-lang
<FromGitter>
<j8r> `when "do_something" then do_something`
<FromGitter>
<greenbigfrog> yep. let's see what idea scott has 😏