pawnbox has quit [Read error: Connection reset by peer]
gloscombe has joined #crystal-lang
pawnbox has joined #crystal-lang
<FromGitter>
<International> i'm checking out webmock.cr , and i'm not sure whether i ran into a bug in the library, or if i'm doing something wrong, and adding puts statements everywhere is tiresome :D
pawnbox_ has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
<FromGitter>
<sdogruyol> @luislavena kinda
<FromGitter>
<sdogruyol> Nokogiri also fails with namespaces
<FromGitter>
<International> thank you @luislavena , i'll give it a try!
<FromGitter>
<johnjansen> @sdogruyol if you have an xml doc with namespaces, try `doc.xpath_nodes("//*[local-name()='Status']”)` and see if that works
<FromGitter>
<International> @luislavena , I tried the examples, and with ints the values are displayed, when doing a `info locals`, but with other objects, it seems only the address is displayed, like : `$1 = (struct String *) 0x1003dde70` . Do you know how I could inspect strings, or other objects?
<FromGitter>
<International> it seems that doing something like `p *my_string` is a good starting point
<FromGitter>
<sdogruyol> @johnjansen thanks for the tip
Raimondi has quit [Ping timeout: 260 seconds]
mhib_ has joined #crystal-lang
mhib_ has quit [Client Quit]
balotelli266 has joined #crystal-lang
balotelli266 has quit [Remote host closed the connection]
<FromGitter>
<luislavena> @International not sure you can inspect complex objects *yet*, I haven't tried it (I'm more a *puts debugger* than anything :smile:)
mhib has quit [Quit: Leaving]
pawnbox_ has quit [Ping timeout: 252 seconds]
pawnbox has joined #crystal-lang
gloscombe has quit [Ping timeout: 250 seconds]
gloscombe has joined #crystal-lang
Raimondi has joined #crystal-lang
<FromGitter>
<johnjansen> anyone know if/how you can get the class of a caller
<crystal-gh>
[crystal] kostya opened pull request #3493: allow rand with zero value (master...rand_zero) https://git.io/vXOR0
<BlaXpirit>
johnjansen, uhhhh it would have to be a macro
<BlaXpirit>
what comes to mind is a macro that outputs `\{{@type}}`
<FromGitter>
<johnjansen> thats what i was thinking, which would be ok … im just considering a better log formatter, one that is A) structured and B) includes the caller so the messages are more consumable from log analyzers …
Raimondi has quit [Ping timeout: 244 seconds]
Raimondi has joined #crystal-lang
<FromGitter>
<citizen428> @luislavena thanks for explaining... my problem is that i want to test that calling my macro defines a new module, so defining it beforehand somewhat defeats the purpose
mark_66 has quit [Remote host closed the connection]
Raimondi has quit [Ping timeout: 244 seconds]
am_ has joined #crystal-lang
<FromGitter>
<johnjansen> @citizen428 consider this, if your module doesnt get defined (by calling your macro) one of 2 things will likely happen, A) your code wont compile, since macro’s run at compile time and must generate valid code OR B) your module will be defined, and will therefore be testable. this seems sensible to me, someone else may disagree?
am_ has quit [Ping timeout: 250 seconds]
<FromGitter>
<jwoertink> Is there a way to run a filter on specs like `:focus`?
<FromGitter>
<johnjansen> do you mean run a subset of specs?
<FromGitter>
<luislavena> @citizen428 invoke your macro at the top of your spec file, in the class/module you're expected it to work, write a spec that check that sample gets the module in it
<FromGitter>
<luislavena> sometimes just a `typeof(MyModule::ModuleFromMacro)` in a spec will be enough to check that the macro worked.
Philpax has quit [Ping timeout: 268 seconds]
<FromGitter>
<jwoertink> @johnjansen Yeah. Like with RSpec, you can set filters to say only run specific specs.
<FromGitter>
<johnjansen> i dont see anything in the source, but you could certainly use an ENV var and a condition to get very similar behaviour
<FromGitter>
<jwoertink> That's what I'll probably do then. Thanks
<FromGitter>
<johnjansen> good luck, let me know how you get on … id have a hack at it but i should do some real work ;-)
vikaton has joined #crystal-lang
lacour has joined #crystal-lang
gloscombe has quit [Remote host closed the connection]
matp_ has joined #crystal-lang
matp has quit [Ping timeout: 260 seconds]
pawnbox has quit [Remote host closed the connection]
Renich has joined #crystal-lang
bazaar has quit [Ping timeout: 265 seconds]
bazaar has joined #crystal-lang
pawnbox has joined #crystal-lang
<FromGitter>
<redcodefinal> Hi guys! New to Crystal, was recently looking at crystal again after letting it mature for a while, and I wanted to get some opinions on somethings I was looking to try. For starters, I have a pretty heavy Ruby background, I really enjoy the MetaProgramming aspects of Ruby. I am mainly looking at Crystal to port and speed up a project I wrote called [isometric-world-generator]
<BlaXpirit>
some of your questions involved "... like Ruby" which I cannot answer without additional information
<FromGitter>
<redcodefinal> @BlaXpirit Ruby has an ImageMagick implementation called rmagick. Really I only use it to combine a bunch of single textures into a large sheet to improve speed. Is there a similar shard for Crystal?
<BlaXpirit>
probably not. just basic pixel manipulation and image format implementations
<BlaXpirit>
or you can manipulate textures with opengl and opengl-like APIs
<FromGitter>
<redcodefinal> Shoot, not a deal breaker, I can still load each texture in it's own single instance
<BlaXpirit>
i dunno, `with` is probably not a thing by itself, just this construct `with ... yield` (linked above)
<BlaXpirit>
> The default receiver within a captured block can't be changed by using with ... yield
<BlaXpirit>
hm it's an even weirder piece of documentation
<FromGitter>
<redcodefinal> hmm
<BlaXpirit>
but yeah, this is `yield` which changes the default receiver
<FromGitter>
<redcodefinal> I guess I'll just have to rewrite how my layer logic works but so far everything seems doable'
<FromGitter>
<redcodefinal> Thanks for the support @BlaXpirit and writing CRSMFL so I can do this
<FromGitter>
<redcodefinal> Looks like I am going to have to make a Perlin Noise library
<BlaXpirit>
great project to familiarize yourself
<shawn42>
hey guys, quick question: if I have some JSON that is an array of arrays of ints.. why doesn't JSON.parse(json) as Array(Array(Int32)) work?
<FromGitter>
<redcodefinal> @BlaXpirit Yeah I am trying to decide whether or not to do the C bindings directly from [Spooners](https://github.com/Spooner/ruby-perlin/blob/master/ext/perlin) implementation or to port his C code into Crystal and do it that way.
<shawn42>
<-- total crystal newb
<BlaXpirit>
redcodefinal, i'd go for porting code. i'm not aware of the more complex implementations. the example on wikipedia seems very simple
<BlaXpirit>
shawn42, because JSON.parse returns a magical JSON::Any object
<FromGitter>
<redcodefinal> @BlaXpirit hey is play.crystal.com working for you? When I run any code it sends me right back to the editor without showing me output
<FromGitter>
<johnjansen> seems fine to me @redcodefinal
<FromGitter>
<cjgajard> @redcodefinal something I have to open them in an incognito window
<BlaXpirit>
redcodefinal, :( yeah this bug has been getting real annoying lately
<FromGitter>
<redcodefinal> @BlaXpirit thanks fixed it
<FromGitter>
<redcodefinal> @BlaXpirit tested the instance_exec, looks like that will work for what I need, thanks for the help :smile:
<FromGitter>
<iDev0urer> Is there any way to create an `XML::Node` without parsing a XML string? Every overload for `XML::Node.new` takes a pointer to something from `LibXML`
<BlaXpirit>
yeah, trying random stuff in combination of an unsafe method `pointerof` will do that
<FromGitter>
<iDev0urer> Haha, I figured. Any idea how to create a `XML::Node`?
<FromGitter>
<iDev0urer> I would really rather not have to do it by stitching strings together
<BlaXpirit>
i don't think it can be done with the current bindings
<FromGitter>
<iDev0urer> Well that bites
<FromGitter>
<johnjansen> how about parsing a string and then setting the attributes on the node
<BlaXpirit>
heh yeah good idea
<BlaXpirit>
problem is i don't think you can set attributes
<FromGitter>
<iDev0urer> so something like this? `node = XML.parse("<hello />").children[0]`
<FromGitter>
<iDev0urer> That works in theory, but feels extremely hacky
<FromGitter>
<iDev0urer> And like @BlaXpirit said, I don't think you can set attributes
<FromGitter>
<iDev0urer> I think the `XML` module just needs some TLC
<FromGitter>
<johnjansen> </> is enough
<FromGitter>
<johnjansen> I'm in the car so I can't look at the node source, but I'd be surprised if you can't set attributes
<FromGitter>
<iDev0urer> The problem is that attributes are also nodes and have the same inherent problem. `Node` also doesn't have an `#attributes=(attributes)` method
bjz has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
Fichtenstein has quit [Quit: Fichtenstein]
kulelu88 has joined #crystal-lang
<FromGitter>
<redcodefinal> Does anyone know where the docs are for the getter setter property methods are?
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]