vimz

Activity Graph

Page 1 of 1

2015-07-28

[10:54:07] vimz: Ping timeout: 240 seconds

2015-07-27

[00:00:08] vimz: >> def foo; "#{__method__}"; end; def baz; foo; end; # expecting 'baz'
[00:00:19] vimz: banister horrah, thanks
[00:11:38] vimz: banister oh, that's embarassing x) do you know how I could achieve "baz" ?
[00:12:41] vimz: but __method__ is encapsulated inside foo, so foo will always return foo. I'll write a gist
[00:14:48] vimz: banister ah it is quite indepth, I thought there was a little trick, no worries
[00:14:56] vimz: unless you're in the middle of something
[00:16:35] vimz: banister cool thanks a lot :) https://gist.github.com/anonymous/448b10c7462567438ea9
[00:17:28] vimz: it's late, i meant https://gist.github.com/anonymous/985585f267ada2398a6e
[00:21:39] vimz: banister thanks, that's aweome :)
[01:00:01] vimz: does anyone know where RSpec's actual_formatted and expected_formatted are defined?
[01:02:08] vimz: thought they'd be in here :P https://github.com/rspec/rspec-expectations/blob/master/lib/rspec/matchers/built_in/eq.rb
[01:04:13] vimz: what I got...good old google. better than githubs serch engine.
[01:08:19] vimz: craysiii why not bing? ._____________________________.
[02:23:23] vimz: 'nineninety'.scan /nine|ninety/ #=> ["nine", "nine"] . I want => ["nine","ninety"] The problem is that my regex matches the second nine inside ninety before it match the entire word ninety. My regex needs to follow this logic: Match a group ONLY if the pattern is not included in a longer group. i.e. 'ninety' is longer than 'nine' by 2 chars. Can this be done with regex? What's a really good ruby book on regex as well, I'm fed up of hitting a brickwall w
[02:32:09] vimz: bmcginty appreciate it...how did you learn regex btw? any recommendations?
[03:00:43] vimz: bmcginty sorry went afk, yeah it's a set of numbers, not just ninety. so we're look at eighty, seventy ect. could hardcode something but I like code that's reusable..even if Im not good enough to write it myself yet :P (tbf its only regex that properly stumps me)
[03:48:44] vimz: bmcginty haha horror potential okay, thanks a lot
[03:48:57] vimz: and yes, single words for now :)
[09:03:31] vimz: Ping timeout: 240 seconds
[15:06:32] vimz: How do I write a spec for a custom matcher? All I want to test is that the failure message, failure message when negated and description get called depending on the data.. Basically I've found a bug in my custom matcher and I want to stamp it out properly with TDD.
[15:07:12] vimz: ljarvis nobody's evere there :'(
[15:09:32] vimz: does anyoone here have a bit of indepth knowledge regarding rspec? #rspec is a graveyard
[15:10:48] vimz: ljarvis dudedudeman cool thanks
[15:11:04] vimz: has joined #RubyOnRails
[15:11:44] vimz: does anyoone here have a bit of indepth knowledge regarding rspec? #rspec is a graveyard
[15:11:51] vimz: How do I write a spec for a custom matcher? All I want to test is that the failure message, failure message when negated and description get called depending on the data.. Basically I've found a bug in my custom matcher and I want to stamp it out properly with TDD.
[15:12:44] vimz: mwksl thanks, i am still learning rspec. really thought matcher testing would be google-able :s
[15:15:12] vimz: tubbo thanks, checking it out :)
[15:16:33] vimz: tubbo ahh expects within expects
[16:14:15] vimz: I swear there was a ruby block to supress all console output. silent{ puts 'hi' } #=> *nothing* have I misremembered?
[16:19:16] vimz: workmad3 that could be it, I'll try it out :)
[16:45:47] vimz: adaedra. that might just about do it..thanks all :)
[20:27:42] vimz: Right. How am I supposed to spec a custom matcher? Here I'm testing 'eq' works correctly. All specs shoud pass: https://gist.github.com/anonymous/68bb8f4d37a70a12723c Only the first exception passes. The expectations that contain failing expectations fail because the expectation inside them fails and doesnt return anything for the outerspec to evaluate.
[20:27:58] vimz: Right. How am I supposed to spec a custom matcher? Here I'm testing 'eq' works correctly. All specs shoud pass: https://gist.github.com/anonymous/68bb8f4d37a70a12723c Only the first exception passes. The expectations that contain failing expectations fail because the expectation inside them fails and doesnt return anything for the outerspec to evaluate.
[20:36:48] vimz: jhass ah yes . thanksies

2015-07-26

[08:11:49] vimz: Ping timeout: 264 seconds
[12:00:09] vimz: has joined #ruby
[16:03:15] vimz: I swear there was an rspec matcher like this expect('ststringy').to include('st').twice } the 'twice' is undefined? :S
[16:07:00] vimz: busteram oh I see, thanks
[16:10:35] vimz: busteram yeah that's what I've done :)
[16:11:21] vimz: jdeen MyCoolClass.new.send(:magic_word) ?
[16:11:29] vimz: oh no that's an instance, nm :P
[16:38:52] vimz: is there a Gem for contextually pluralized a word? "I have #{(3, 'dog')}" #=> 'I have 3 dogs'
[16:39:22] vimz: "I have #{pluralize(3, 'dog')}" #=> 'I have 3 dogs'
[16:40:22] vimz: triangles nice! thanks
[16:46:26] vimz: triangles: I can require 'active_support/inflector' okay, but pluralize is unavailable for the main object?
[16:56:19] vimz: triangles no worries, thanks again
[19:40:01] vimz: can I join two numbers together without converting them into strings? eg 5.join 2 #=> 52
[19:45:40] vimz: ytti no that'll only work if the first number is divisble by 10. what if I want 123.join 321
[19:45:47] vimz: ill just string interpolate
[19:48:57] vimz: craysiii very clever. thanks :)
[19:53:05] vimz: havenwood: damn. you're a genus
[19:53:46] vimz: Coraline haha
[19:55:39] vimz: I would not mind the havenwood species' maths phenotype :/
[22:49:50] vimz: biscuitz try getting rid of the @
[22:50:20] vimz: instance_variable_get(:capacity) .. I think anyway, I had that error ages ago
[22:52:19] vimz: ['b','a'] => /[b | a]/
[22:52:44] vimz: while he's making a gist, can I turn an array into a simple regex? :P
[22:54:03] vimz: Ox0dea thatnks, exactly what I needed
[23:23:15] vimz: Ox0dea thanks for the gotcha, I did spot that was an OR :)
[23:47:40] vimz: is it possible for ruby code to know what method it is inside? def foo magic_method #=> 'Im inside foo' end def baz magic_method #=> 'Im inside baz' end

2015-07-24

[05:40:18] vimz: Ping timeout: 240 seconds
[11:34:03] vimz: has joined #ruby

2015-07-23

[00:38:00] vimz: Quit: leaving
[12:49:41] vimz: has joined #ruby
[13:10:43] vimz: RSpec question https://gist.github.com/anonymous/45161665c88630a2a711 how do I store code in a variable using lets ?
[13:21:24] vimz: DylanJ sorry I meant let :P any ideas?
[13:24:17] vimz: RSpec folks: how do I store code in a variable using let ?
[13:26:19] vimz: I'll write it properly
[13:43:13] vimz: Dylan J thanks for laying out the syntax, but how do I do that with code to be run, rather than just variables? Is this any clearer? https://gist.github.com/anonymous/45d73fc2e009e098e66d
[13:47:06] vimz: here is my question with syntax highlighting. dw, it's the last time I'm asking https://gist.github.com/anonymous/81a71fa7b80cec3cef33 How do I store ruby code using a let ?
[16:31:42] vimz: is it possible to delete from an array using map? e.g. [:a,:b].map{ |v| v.reject! if v == :a } #=> [:b] | or is the ONLY real way to do it by having the entire array and calling a method just as reject or delete on the WHOLE array, e.g. [:a,:b].delete...
[16:36:00] vimz: adaedra yes, remove elements depending on the block and the in-block value of v. just wondering if it can be done inside an existing loop or if I have to use a different loop on the whole array such as #reject or #delete
[16:41:33] vimz: jhass: wondering if delete_if could be created in this way?
[16:41:58] vimz: jhass: that's it?
[16:42:18] vimz: jhass: it's irb :L
[16:42:51] vimz: jhass yep
[16:45:34] vimz: havenwood I'd like to see how that could be done, yes :)

2015-07-22

[19:46:02] vimz: Quit: leaving
[20:44:17] vimz: is this possible? https://gist.github.com/anonymous/5be6caa76b487bebfe44 accessing a varible outside the context of yield. I really hope it is! also, untested that code might actually work xD
[20:48:28] vimz: Mon_Quie yield array? what does that mean? and yes all I need is for the block to access the array. example? thanks
[20:50:05] vimz: Mon_Ouie cool. oooohh. So if we were to type | yield array, foo, bar, biz | array, foo, bar and biz variables would all be available inside the proc that's executed by yield?
[22:08:17] vimz: how should I pass a block onto another method? def meth1 &b end def meth2 &b b.call end ?

2015-07-21

[15:41:24] vimz: if I have a class that excepts a block argument, and the block argument is prepended with a &, then to_proc is automatically called on that block. to_proc is a method inside the class that you can override by writing it manually right? | class MyClass def to_proc end end | anyway, how to I pass an argument to that to_proc method?
[15:47:54] vimz: shevy haha I think they should. but okay.

2015-07-19

[13:03:05] vimz: is anyone prepared to explain procs to a n00b? Slowly. :P https://gist.github.com/anonymous/2b6369fea84ae625c9bb
[13:06:40] vimz: [k- okay, that clears it up a bit. And a proc is just a portable, executable snippet of code?
[13:08:53] vimz: [k- okay...what is a proc then? if not a portable snippet of code?
[13:10:27] vimz: Mon_Ouie nice. By portable I mean you can pass it into methods.
[13:11:14] vimz: But why do we want to turn these arguments into procs?
[13:11:48] vimz: [k- haha no worries
[13:27:43] vimz: Ox0dea haha yes not magic I am told
[13:28:09] vimz: [k- what part of my English tripped you up?