Ruby client
Closed this issue · 19 comments
Stelian commented
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?
simicic commented
Will come! ;) Now, let's see who makes it first!
simicic commented
rosstuck commented
janpaul commented
File.readlines($1).sample
or
# with error handling ;-)
File.readlines($1).sample if $1
rosstuck commented
simicic commented
haha, @janpaul believe it or not, that was my first thought, there should be some tests!! 😄 it seems you know me well...
Stelian commented
I just ... /me walks away
janpaul commented
@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
simicic commented
I am sorry @janpaul but this does not guarantee randomness, foobar could be my name ;)
you forgot one should have_received :sample
;)
rosstuck commented
Reopening until we have a Ruby raffler with raffler with drama!
ramondelafuente commented
I wonder if I should try... does Ruby have any functions that start with "array_" ?