jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.17.3 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
tliff has joined #crystal-lang
<jhass> >> puts Math::PI
<jhass> uh
DeBot has joined #crystal-lang
<jhass> >> puts Math::PI
<DeBot> jhass: 3.14159 - more at https://carc.in/#/r/zca
<jhass> mmh, good question
<jhass> >> puts "%.10f%" % Math::PI
<DeBot> jhass: malformed format string - %'\u{0}' (ArgumentError) - https://carc.in/#/r/zcb
<jhass> >> puts "%.10f" % Math::PI
<DeBot> jhass: 3.1415926536 - more at https://carc.in/#/r/zcc
<ryanw-se> i worked around it with Math.atan2(0.0, -1.0) but still weird that it doesn't print out the full value of the constant
<ryanw-se> actually, never mind that did the same thing t.t
<jhass> yeah, see my example on how to get more and my link as to why
<jhass> >> puts "%.12f" % Math::PI
<DeBot> jhass: 3.141592653590 - more at https://carc.in/#/r/zcd
<jhass> >> puts "%.20f" % Math::PI
<DeBot> jhass: 3.14159265358979311600 - more at https://carc.in/#/r/zce
<jhass> mmh, that's a bit worrying
<jhass> >> Math::PI* 10**20
<DeBot> jhass: # => -6.74652e+09 - https://carc.in/#/r/zcf
<jhass> >> (Math::PI* 10**20).to_i
<DeBot> jhass: # => -2147483648 - https://carc.in/#/r/zcg
<jhass> >> (Math::PI* 10**20).to_u64
<DeBot> jhass: # => 18446744069414584320 - https://carc.in/#/r/zch
<jhass> >> (Math::PI* 10**20).to_i64
<DeBot> jhass: # => -6746518852 - https://carc.in/#/r/zci
<jhass> >> Math::PI.to_big_float
<DeBot> jhass: undefined method 'to_big_float' for Float64 - https://carc.in/#/r/zcj
Philpax has joined #crystal-lang
Philpax_ has joined #crystal-lang
Philpax has quit [Ping timeout: 240 seconds]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 240 seconds]
emancu has joined #crystal-lang
dhk has quit [Quit: Leaving]
jmcharnes has joined #crystal-lang
jmcharnes has quit [Client Quit]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 264 seconds]
|2701 has quit [Quit: Connection closed for inactivity]
Philpax_ has quit [Ping timeout: 244 seconds]
emancu has quit [Read error: Connection reset by peer]
emancu has joined #crystal-lang
<ryanw-se> its mentioned a lot, but I wasn't able to find any actual sources... does Crystal compile down into C?
<ryanw-se> or does it have performance similar to C
willl has quit [Quit: Connection closed for inactivity]
Philpax has joined #crystal-lang
emancu has quit [Read error: Network is unreachable]
emancu has joined #crystal-lang
emancu has quit [Read error: Connection reset by peer]
emancu has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
trapped has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
ryanw-se has quit [Read error: Connection reset by peer]
emancu has quit [Read error: Connection reset by peer]
emancu has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
emancu has quit [Remote host closed the connection]
soveran has joined #crystal-lang
buggs has quit [Ping timeout: 250 seconds]
soveran has quit []
jwaldrip has quit [Ping timeout: 260 seconds]
guilleiguaran__ has quit [Ping timeout: 260 seconds]
guilleiguaran__ has joined #crystal-lang
aemadrid has quit [Ping timeout: 260 seconds]
bjmllr has quit [Ping timeout: 260 seconds]
jwaldrip has joined #crystal-lang
mroth has quit [Ping timeout: 260 seconds]
avdi has quit [Ping timeout: 260 seconds]
avdi has joined #crystal-lang
aemadrid has joined #crystal-lang
mroth has joined #crystal-lang
iamstef_ has quit [Ping timeout: 260 seconds]
iamstef_ has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
bjmllr has joined #crystal-lang
elia has joined #crystal-lang
buggs has joined #crystal-lang
mark_661 has joined #crystal-lang
Philpax has quit [Ping timeout: 244 seconds]
Philpax has joined #crystal-lang
elomatreb has joined #crystal-lang
bjz has joined #crystal-lang
bjz has quit [Max SendQ exceeded]
bjz has joined #crystal-lang
bjz has quit [Max SendQ exceeded]
bjz has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
Philpax has quit [Ping timeout: 244 seconds]
bjz has joined #crystal-lang
elia has quit [Quit: (IRC Client: textualapp.com)]
<jhass> !memo ryanw-se no, it is a LLVM frontend
<DeBot> jhass: Added memo for ryanw-se.
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 252 seconds]
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Philpax has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
sdogruyol has joined #crystal-lang
<sdogruyol> how can i send a post request with a SSL certificate via HTTP::Client
<sdogruyol> more explicitly with a .cer file
<jhass> I don't think we have API for that
<jhass> yet
<jhass> afaik the general openssl way is to set the credentials in the ssl sockets context
<sdogruyol> probably
|2701 has joined #crystal-lang
<sdogruyol> for now is there anything i can do to make it happen?
<jhass> well probably exactly that
<sdogruyol> how do i build a request like that?
<sdogruyol> like you said there’s no api and i dont know how to access the underlying ssl socket for the request
<sdogruyol> actually i need to access it before sending the request
<sdogruyol> wow that seems scary :P
<jhass> perhaps we can make the ssl option either accept true or a context
<sdogruyol> definitely a context would be great
<sdogruyol> why do i need to patch Context? It seems pretty ok to me
<jhass> oh you think chain should include the end entity? mmh
<jhass> SSL_CTX_use_certificate_chain_file() loads a certificate chain from file into ctx. The certificates must be in PEM format and must be sorted starting with the
<jhass> subject's certificate (actual client or server certificate),
<jhass> sounds good indeed, nvm
<sdogruyol> well
<sdogruyol> i dont have any intermediate ca or so
<sdogruyol> just a .cer which contains everything
<jhass> weird that the order is the other way around than usually here
<sdogruyol> i just need to pass that to context
<jhass> normally it's root -> intermediates -> entity
<sdogruyol> :D
<sdogruyol> now i need to find a way to make the socket accept that certificate and pass it to context
<jhass> the socket already accepts a context
<sdogruyol> yeah
<sdogruyol> just saw that
soveran has quit [Remote host closed the connection]
matp has quit [Ping timeout: 260 seconds]
<sdogruyol> @jhass actually i need ssl_cert_file not ssl_ca_cert_file
<sdogruyol> seems like that’s not in Context
<jhass> huh?
<jhass> see above
<sdogruyol> are you sure
<jhass> fairly
<sdogruyol> i’ve monkey patched HTTP::Client like this https://gist.github.com/sdogruyol/5832963b7b43cd7f6c45347fca9e7fa4
<sdogruyol> this should do the trick right?
<jhass> to_slice?
<jhass> it expects a file path
<sdogruyol> it’s expects a Pointer(UInt8)
<sdogruyol> that’s why i cast
<jhass> which is a String (crystal will convert it automatically)
<jhass> and that string should contain a path to a file
Raimondii has joined #crystal-lang
<sdogruyol> yeah it does
<sdogruyol> removed to_slice and it works no difference
Raimondi has quit [Ping timeout: 240 seconds]
<jhass> sdogruyol: of course you also have to set the private key
Raimondii is now known as Raimondi
<sdogruyol> actually there’s not a private key
<sdogruyol> i use ssl_verify_mode :none in Ruby :P
<jhass> wait, this isn't for TLS client auth?
<jhass> but rather validating the server certificate?
<sdogruyol> well it’s backend to backend
<sdogruyol> kinda weird
<jhass> that's not a well defined term in TLS
<sdogruyol> :)
<jhass> let's try to stay on terminology in order to not confuse ourselves and each other
<sdogruyol> okay
<sdogruyol> so i dont have private key
<jhass> what do you want to do
<sdogruyol> and i use ssl_verify_mode :none
<sdogruyol> i want to make a SOAP request with this certificate
<jhass> authenticate that the servers certificate is (indirectly) signed by a specific CA certificate
<jhass> or send a client certificate to the server
<jhass> it sounds like the former
<sdogruyol> yeah i think so
<sdogruyol> so how would i send this certificate to server so that it authorizes me to do SOAP calls :)
<sdogruyol> that’s the problem
<sdogruyol> i monkey patched context to accept the certificate but seems like it’s not going with the request
<jhass> you're contradicting yourself again
<jhass> you say the former but then go on with "sending a certificate to the server"
bjz_ has quit [Ping timeout: 246 seconds]
bjz has joined #crystal-lang
<jhass> if you want to add a new CA certificate for validation, it seems to be SSL_CTX_load_verify_locations or SSL_CTX_set_cert_store
<jhass> I believe the latter is the older/better supported API, at least more broadly used
<jhass> but then SSL_CTX_set_cert_store recommends using SSL_CTX_load_verify_locations
pawnbox has quit [Remote host closed the connection]
dhk has joined #crystal-lang
matp has joined #crystal-lang
<sdogruyol> seems like OpenSSL::SSL::Context is missing those right?
<jhass> yup
<sdogruyol> i need to take a look at LibSSL bindings then
<sdogruyol> SSL_CTX_set_cert_store this seems like it
<jhass> read the manpage, it recommends SSL_CTX_load_verify_locations
<jhass> and that one takes filepaths
<sdogruyol> :/
<jhass> while with SSL_CTX_set_cert_store you first need to get it with SSL_CTX_get_cert_store, then manipulate it with SSL_CTX_set0/1_* which are all just macros
<jhass> so you can't bind to them
<jhass> so more useful for transporting the settings of one context to another
<sdogruyol> can i monkey patch a lib like LibSSL?
<jhass> sure
<sdogruyol> let’s see if i can bind to SSL_CTX_load_verify_locations
<sdogruyol> ouch just got an Invalid Memory Access :P
<jhass> takes two parameters here
<jhass> int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
<jhass> const char *CApath);
<jhass> (i mean three, two strings)
<sdogruyol> yeah
<sdogruyol> i’m still wondering why it takes path if it’s taking the file
<jhass> it's taking both or either
<sdogruyol> let me see
<jhass> "When looking up CA certificates, the OpenSSL library will first search the certificates in CAfile, then those in CApath."
<sdogruyol> weird :P
<jhass> not at all
<sdogruyol> i’m not used to it probably that’s why
<sdogruyol> thanks for the guidance :)
pawnbox has joined #crystal-lang
aharlan has joined #crystal-lang
aharlan has quit [Quit: Textual IRC Client: www.textualapp.com]
dhk has quit [*.net *.split]
Raimondi has quit [*.net *.split]
Davy_CC has quit [*.net *.split]
triangles2 has quit [*.net *.split]
<sdogruyol> also need SSL::VERIFY_NONE
<sdogruyol> how can i pass an enum value to c binding?
* sdogruyol need to set SSL_VERIFY_NONE on SSL_CTX_set_verify()
Philpax has quit [Ping timeout: 252 seconds]
<jhass> sdogruyol: you don't
<jhass> what we do with SSL_CTX_load_verify_locations is set the CA certificate so that the client can validate the server certificate successfully
<jhass> there's no "have the client send a certificate" without a private key
<jhass> note the CertificateVerify message
<sdogruyol> well you are right but this really weird
<sdogruyol> i’m sending a cert without a private key and SSL_VERIFY_NONE
<sdogruyol> actually the certificate doesnt even matter or so lol
<sdogruyol> wtf
<jhass> sdogruyol: how exactly do you send the cert in ruby or whatever?
<sdogruyol> with Savon only the god knows how it works i’m constantly wtfing here lol
<sdogruyol> hold on
<sdogruyol> that ssl_verify_mode :none makes it work
<jhass> okay let me dig a bit
<jhass> did you choose a particular HTTP client for savon anywhere?
<jhass> for Net::HTTP it just sets Net::HTTP#cert, which does nothing without a key
<jhass> where did you get the certificate for and what were the exact usage instructions for it?
<jhass> alternatively I'd be interested in its openssl x509 -noout -text -in foo.pem
<sdogruyol> well i did get it from a big ass Finance company lol
<sdogruyol> no usage instructions just told to send it with the request lol
<jhass> competence at work :P
<sdogruyol> Savon uses Net::HTTP i guess
<sdogruyol> the default
<sdogruyol> the weird thing is that this works when i remove ssl_cert_file
<sdogruyol> so i think ssl_verify_mode does the trick, eh :P
<jhass> not weird at all, just proves my assumption that it's ignored
<jhass> "the trick" being "ignore all security"
<jhass> can we verify that it's not a communication problem and they in fact send you their CA? output of ^ would tell
<sdogruyol> hold on
<sdogruyol> ouch
<sdogruyol> how would you understand that
<jhass> eh I don't remember offhand were but you can see whether it's a CA somewhere
<jhass> could you gist it and PM me?
<sdogruyol> hold on
<jhass> oh boy
mark_661 has quit [Quit: Leaving.]
sebasr has quit []
|2701 has quit [Quit: Connection closed for inactivity]
Raimondi has joined #crystal-lang
triangles2 has joined #crystal-lang
Davy_CC has joined #crystal-lang
sebasr has joined #crystal-lang
Raimondi has quit [*.net *.split]
Davy_CC has quit [*.net *.split]
triangles2 has quit [*.net *.split]
Davy_CC has joined #crystal-lang
triangles2 has joined #crystal-lang
Raimondii has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vrKTq
<crystal-gh> crystal/master 3fd3866 Ary Borenszweig: Merge branch 'release/0.17'
Raimondii is now known as Raimondi
trapped has quit [Read error: Connection reset by peer]
trapped has joined #crystal-lang
<travis-ci> crystal-lang/crystal#f8e0568 (release/0.17 - Compiler: improve error when using Class and other non-allowed types for instance/class/global vars. Fixes #2605. Fixes #2604): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/132607685
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
kfpratt has quit [Remote host closed the connection]
kfpratt has joined #crystal-lang
jmg_ has joined #crystal-lang
ryanw-se has joined #crystal-lang
<jmg_> Hey everyone- working on a small project in Crystal that's working with a lot of interestingly formatted JSON data. In particular there is a field that is a mixed type array. Example: https://play.crystal-lang.org/#/r/zeq I've come across this Github issue (https://github.com/crystal-lang/crystal/issues/1061) which potentially gives me a path forward; however, I'm curious if there's an alternate solution that doesn't involve JSO
<jhass> IRC has a length limit, cut off at "involve JSO"
<jmg_> ...involve JSON::PullParser
<ryanw-se> i have appear to have run into something quite wild, https://play.crystal-lang.org/#/r/zer
<ryanw-se> I'm trying to generate a fibonacci sequence up to a certain size (in this case 9), I'm starting out with an empty array with two entries [0, 1]
<ryanw-se> when I generate the fibonacci sequence, when it gets to the index 0, it seems to believe that there is a 1 that comes before that index, ex [1, 0, 1]
<jhass> >> [1, 2, 3][-1]
<DeBot> jhass: # => 3 - https://carc.in/#/r/zes
<ryanw-se> when I do the opposite [1, 0] (for testing purposes), it correctly identifies the index before 1 as 0
<jhass> -1 gets the last element
<ryanw-se> jhass: why would it identify [0, 1] as -> [1, 0, 1] but identify [1, 0] as -> [0, 1, 0]
<RX14-> jmg_, JSON::PullParser is really quite nice, and you would only have to write the code to deal with that one array and use it as a custom deserialiser for the object
<jhass> ryanw-se: it doesn't
<jmg_> RX14-: Thanks. In that case, I'll definitely look more into it. Just wanted to double-check that there wasn't an easy way out using union types and JSON.mapping
<RX14-> i don't think so, if you look at the JSON.mapping docs you'll see that you can specify a custom converter for any field on a json object
<RX14-> which looks like it would be what you want
<jhass> jmg_: you can also use JSON.parse or JSON::Any in a mapping and do casting https://carc.in/#/r/zf9
<jhass> (and .is_a?)
<RX14-> jhass, where's an example of pull parser usage, it's really quite simple https://carc.in/#/r/zfa
<jmg_> jhass: Ah, hadn't thought about that- I'll try out both methods
<RX14-> oops
<RX14-> s/jhass/jmg_/
<jmg_> RX14-: Thanks!
<RX14-> JSON::PullParser should be better documented
<jhass> patches welcome ;)
<RX14-> but it's the best interface to pull parsers i've ever used
<RX14-> i even ported it to java
<RX14-> because i wanted a pull parser
<RX14-> and the incumbent ones were shite
<RX14-> man, I really love tuple splatting. I can just splat my typed postgres row tuples directly into a method and its all typed
triangles3 has joined #crystal-lang
Raimondii has joined #crystal-lang
<BlaXpirit> hm it's awesome that macros don't just paste code but have a return value https://carc.in/#/r/zfb how does it work? or maybe I'm mistaken and this is a coincidence?
<asterite> RX14-: I never really documented JSON::PullParser because I thought it was more low-level and hard to use. I guess I'll soon add more docs to it. It's true that it's very easy to parse a custom JSON with it :-)
Raimondi has quit [Ping timeout: 258 seconds]
triangles2 has quit [Ping timeout: 258 seconds]
<asterite> BlaXpirit: it's printing the result at runtime, which happens to be the same as an array literal
<asterite> but the elements are definitely added at runtime
<BlaXpirit> asterite, I think you misunderstood me. what I mean to say is this: https://carc.in/#/r/zfd does not happen
<jhass> why is that p _tmpxxx though and not p _tmpxx = [] of Int32; _tmpxxx ....
<asterite> The %a syntax is only available inside macros
<asterite> Hmm... we need someone who understands openssl really well, and make him/her a committer... otherwise openssl will be stuck forever
<jhass> asterite: still not the question
Raimondii is now known as Raimondi
<BlaXpirit> jhass, I see that you understand me. was that a surprise to you as well?
<jhass> yes
<jhass> asterite: https://carc.in/#/r/zfg
<jhass> why is the earlier example with the macro not equivalent to that?
<RX14-> jhass, i assume the whole macro is expanded inside a basic block
<RX14-> i.e. begin/end
<asterite> because a macro is more like a method, where you put expressions one after another in each line
<RX14-> and so has a value and return
<asterite> but you can't put expressions like that in a call argument, you need to use `begin ... end`
<asterite> RX14-: yes, exactly
<RX14-> i thought so
RX14- is now known as RX14
<RX14> damn netsplits
<jhass> so, can we say (and perhaps document?) that a macro wraps its body into begin/end ?
<BlaXpirit> it's a whole new world of opportunities
<RX14> lol ive realised that for a long time
<BlaXpirit> honestly i didn't even keep in mind that this https://carc.in/#/r/zfk works
<asterite> we can document it, but I always saw a macro like a method that's executed at compile time. So, similar to a method, you don't need to put many expressions inside begin/end
<BlaXpirit> well something isn't right because as a newcomer I understood it as pasting text as code
<asterite> Mmm... it's more like, the output of the macro is pasted into the program, but programatically... and so you can paste a series of expressions (Expressions node) like that, but to write it you need begin/end
emancu has joined #crystal-lang
<RX14> it works on the AST level right
<RX14> the macro debug() output is desugared as if it's converted back from an AST
<RX14> asterite, where's the macro docs gone on crystal-lang.org/api/ >
<asterite> Into Crystal::Macros
<asterite> I should probably have documented that in the changelog
<RX14> ah, thankjs
<RX14> i'm surprised that the inner macro isn't expended here: https://carc.in/#/r/zfy
<jhass> asterite: we should probably document the new metadata variables there too
<travis-ci> crystal-lang/crystal#962ae09 (release/0.17 - Missing spec/compiler_spec.cr file): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/132636424
<jhass> *constants
<RX14> which ones?
<asterite> They are :-)
<asterite> (well, they will be)
<jhass> oh, nvm then :D
<jhass> RX14: we added Crystal::VERSION and stuff
<jhass> well, asterite did :P
<asterite> Mmm... actually, they don't have an explanation, but they have the values
<jhass> good enough, somebody will pick that up sooner or later
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vrK2j
<crystal-gh> crystal/master d24f778 Ary Borenszweig: Merge branch 'release/0.17'
jmg_ has quit [Ping timeout: 250 seconds]
sdogruyol has quit [Quit: Connection closed for inactivity]
emancu has quit []
<travis-ci> crystal-lang/crystal#d24f778 (master - Merge branch 'release/0.17'): The build was fixed. https://travis-ci.org/crystal-lang/crystal/builds/132642746
<BlaXpirit> what's a clever way to turn an array into a tuple of predefined types and raise an error if it doesn't match expectations?
<BlaXpirit> nevermind, i need a better approach anyway
<BlaXpirit> oh amazing
soveran has joined #crystal-lang
<BlaXpirit> WTF https://carc.in/#/r/zg8
<jhass> hah
soveran has quit [Remote host closed the connection]
<BlaXpirit> what I was really trying to show is error messages for wrong arguments are not helpful
<BlaXpirit> but uh instead i bypassed a type restriction
<jhass> yup
<jhass> still reproduces on head
<BlaXpirit> i reported anyway
pawnbox has quit [Ping timeout: 276 seconds]
dhk has joined #crystal-lang
|2701 has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
willl has joined #crystal-lang
soveran has joined #crystal-lang
Ven has joined #crystal-lang
<leafybasil> Is there any best practice around the use of JSON#mapping macro when APIs are less tidy than you'd hope?
<jhass> there's not much best practices yet at all I'm afraid ;)
<leafybasil> Haha
<jhass> anything specific you struggle with?
<leafybasil> Yeah I hit two endpoints, one is for a list of `transactions`, the other for a single `transaction`
<leafybasil> As a result I have class Transactions; JSON.mapping({ transactins: Array(Transaction) }); end
<leafybasil> WHich works fine
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leafybasil> However the retrieve endpoint returns a payload with a singular envelope of 'transaction'
<leafybasil> So I can't call Transaction.from_json() on it, as it's a different structure
<leafybasil> I could create two classes, one for unwrapping each envelope, it feels a bit icky
<jhass> we had some discussion about that https://github.com/crystal-lang/crystal/pull/789
<jhass> https://play.crystal-lang.org/#/r/2vf basically Ary suggests to write a macro that creates both classes/structs
<leafybasil> Yeah Im reading that code now. It's clever, but also far less convenient than an inbuilt macro/config
<jhass> I don't disagree obviously ;)
<leafybasil> :0
<leafybasil> :)
<jhass> feel free to open a new PR tackling that issue (and referencing mine doing so), shows there's some demand for a solution to this ;)
<leafybasil> Well crystal syntax so far has been really nice (obviously), so it seems uncharacteristic to have to write something like this for what is a fairly common case
<leafybasil> I shall do thanks
<jhass> I could also imagine something like Transaction.from_json(json, root: "transaction") for the API
<jhass> Array(Transaction).from_json(json, root: "transactions")
<jhass> transactions: {Array(Transaction), root: "transactions"}
<jhass> all these would pass it on to new which accepts it optionally and assumes a hash with that key present in that case
<jhass> I think that should cover most cases fairly elegantly
<leafybasil> yeah that's exactly what I think
soveran has quit [Remote host closed the connection]
Ven has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
dhk has quit [Quit: Leaving]
<leafybasil> @jhass if you want to thumb it up, it's issue 2642
<leafybasil> Thumbed it myself. Feel so cheap.
<jhass> <3
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vr6JP
<crystal-gh> crystal/master 66b5025 Ary Borenszweig: Merge branch 'release/0.17'
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
srabuini has joined #crystal-lang
sebasr has quit [Ping timeout: 258 seconds]
<travis-ci> crystal-lang/crystal#780443a (release/0.17 - Compiler: cover check wasn't taking named arguments into account. Fixes #2640): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/132684947
<travis-ci> crystal-lang/crystal#66b5025 (master - Merge branch 'release/0.17'): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/132684977
A124 has quit [Ping timeout: 272 seconds]
A124 has joined #crystal-lang
Philpax has joined #crystal-lang
dhk has joined #crystal-lang
Philpax has quit [Ping timeout: 252 seconds]
soveran has quit [Remote host closed the connection]
<crystal-gh> [crystal] mperham opened pull request #2644: Change default float format (master...patch-1) https://git.io/vr6nT
<crystal-gh> [crystal] mperham closed pull request #2644: Change default float format (master...patch-1) https://git.io/vr6nT
dhk has quit [Quit: Leaving]
dhk has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 246 seconds]