domcode/rafflers

Ruby client

Closed this issue · 19 comments

As far as I've seen there is only a php and a python client but no ruby. Can we have a ruby client please?

Will come! ;) Now, let's see who makes it first!

popcorn

Stelian's got 6 hours of meetings today, so advantage is yours, @simicic!

@simicic you have a small heads up, but the war ain't over!

haha, then the good news can be that I work as well, maybe someone else can come in!

There's no rule that says we can't have multiple rafflers in the same language. That would even be fun.

There's also no rule that says a dog can't play basketball.
air bud

File.readlines($1).sample

or

# with error handling ;-)
File.readlines($1).sample if $1

whaaa

Seriously though, PR? :) And then no more GIFs for me today, I promise.

I will leave that for @simicic . She probably wants to write a spec too ;-)

haha, @janpaul believe it or not, that was my first thought, there should be some tests!! 😄 it seems you know me well...

@simicic oh I absolutely believe it! I've known you a bit longer than today ;-)

/me points at #4

@Stelian here you go ;-)

File.readlines($1).sample if $1 && File.exists?($1)

oh no! where are the tests @Stelian ?? 😄

I just ... /me walks away

@simicic another shorty for you then

describe Raffle do
  let(:raffle) { Raffle.new } 
  it 'should be something sensible' do
    allow(File).to receive(:readlines).and_return %w(foobar)
    expect(raffle.run).to eq 'foobar'
  end
end

I am sorry @janpaul but this does not guarantee randomness, foobar could be my name ;)
you forgot one should have_received :sample ;)

Reopening until we have a Ruby raffler with raffler with drama!

I wonder if I should try... does Ruby have any functions that start with "array_" ?