<Cork>
the core net/http causes "warning: Object#timeout is deprecated, use Timeout.timeout instead." warnings, anyone know if there is an issue somewhere about handling this?
cgfbee has joined #ruby
WhereIsMySpoon has joined #ruby
WhereIsMySpoon has joined #ruby
WhereIsMySpoon has quit [Changing host]
WhereIsMySpoon has quit [Remote host closed the connection]
tdy1 has quit [Ping timeout: 244 seconds]
tdy1 has joined #ruby
gkos has joined #ruby
tjbp has quit [Remote host closed the connection]
tjbp has joined #ruby
kyrylo has joined #ruby
WhereIsMySpoon has joined #ruby
WhereIsMySpoon has quit [Changing host]
WhereIsMySpoon has joined #ruby
<WhereIsMySpoon>
is there any way to somehow return from a begin-rescue-end block? Otherwise each time I have one I need to put it in a separate function which is just a bit annoying for such a small piece of code
<WhereIsMySpoon>
or assign the result of the block to a variable
<phaul>
WhereIsMySpoon: paste a snippet of code, and we will try to refactor
<ytti>
do remember that def, rescue, end is an option
<WhereIsMySpoon>
ytti: eh?
<phaul>
if there was no error then throw catch.
<phaul>
but that's just one way
<WhereIsMySpoon>
phaul: https://pastebin.com/XjM0uKNr so if i wanted baz available outside the block id need to do that
<ruby[bot]>
WhereIsMySpoon: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<WhereIsMySpoon>
phaul: is there some way i dont have to do either of those and just assign baz equal to the result of evaluating the begin-rescue-end block somehow?
<ytti>
WhereIsMySpoon, def foo(input); JSON.parse! input; rescue # do stuff; end
<WhereIsMySpoon>
ytti: right but thatd still be a separately defined function for essentially 1 or 2 lines of code
<phaul>
baz = begin JSON.parse! ... end
<ytti>
baz = JSON.parse!(input) rescue "poop"
<ytti>
but this is discouraged
<WhereIsMySpoon>
why
<WhereIsMySpoon>
i assume phaul's version is also discouraged?
<ytti>
generally not considered idiomatic
<ytti>
but that doesn't mean you can't use it
def_jam is now known as eblip
<phaul>
do you want baz to contain some value from rescue if there is an error, and supress the exception , or do you want the error to be rasied to upper level
<phaul>
if you want to supress it then ytti's solution is the same , otherwise in baz = begin ... rescue .. raise $! end
<WhereIsMySpoon>
i want the error to be raised
<WhereIsMySpoon>
i dont want baz to contain the error
<phaul>
then just re-raise $! in rescue
<phaul>
hangon. for these two lines it's the same as:
DmitryBochkarev has quit [Ping timeout: 272 seconds]
pwnd_nsfw has joined #ruby
UncleCid__ has quit [Ping timeout: 255 seconds]
garyserj has joined #ruby
barg has quit [Ping timeout: 245 seconds]
DmitryBochkarev has joined #ruby
yokel has quit [Ping timeout: 272 seconds]
yokel has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
conta has joined #ruby
ldnunes has joined #ruby
yokel has quit [Remote host closed the connection]
yokel has joined #ruby
Devalo has joined #ruby
Devalo has quit [Ping timeout: 268 seconds]
AJA4350 has joined #ruby
houhoulis has joined #ruby
t0xik has quit [Quit: Connection closed for inactivity]
<WhereIsMySpoon>
I have a function on Mongo::Client that's just #[] - how do I mock this with rspec? I tried client.stub!(:[]).and_return(foo) but it complains
<WhereIsMySpoon>
#[] returns a Mongo::Collection given a valid arg in [] like say my_client[:my_collection_name]
<WhereIsMySpoon>
"#<Double "Mongo::Client"> received unexpected message :stub! with (:[])"
<phaul>
no, boat is ashore. I'm at my dad's in hungary
<phaul>
I have no money to launch it, or to boat this year
<phaul>
such is life :)
<al2o3-cr>
ah, ok. maybe next year hopefully :)
<phaul>
diging myself into front end stuff, jumped to elm from react. It's quite enjoyable
<phaul>
especially if haskell syntax is somewhat familiar to you
<al2o3-cr>
oh, that's cool. how's going?
<al2o3-cr>
no, never did haskell.
<phaul>
slowly taking over the world :)
Nicmavr has quit [Read error: Connection reset by peer]
<phaul>
I think elm is a lot more approachable than haskell
<phaul>
and a lot smaller
<al2o3-cr>
like they say, learn as many as possible.
Nicmavr has joined #ruby
<al2o3-cr>
i'd like to seriously start getting to grips with rust/go
gkos has joined #ruby
houhoulis has quit [Remote host closed the connection]
RubyGuyNeedsHelp has joined #ruby
<RubyGuyNeedsHelp>
I need to downcase the first line of a file without reading the entire file into memory. I know how to read only the first line File.open('largefile.csv') {|f| f.readline} but how do I write to the same file without loading it all into memory?
v01d4lph4 has quit [Read error: Connection reset by peer]
evdubs has quit [Remote host closed the connection]
v01d4lph4 has joined #ruby
evdubs has joined #ruby
v01d4lph4 has quit [Remote host closed the connection]
<lupine>
RubyGuyNeedsHelp: f.rewind; f.write(...)
fredolinhares has joined #ruby
<lupine>
you'll need to open it 'r+' and hope nobody else is concurrently editing it
<lupine>
also, this approach only makes sense if your downcased data is the same number of bytes. this is a safe assumption for ascii files, but not generally safe
_joes_ has quit [Ping timeout: 245 seconds]
BH23 has quit [Ping timeout: 272 seconds]
_joes_ has joined #ruby
BH23 has joined #ruby
gkos has quit [Remote host closed the connection]
gkos has joined #ruby
v01d4lph4 has joined #ruby
v01d4lph4 has quit [Remote host closed the connection]
WhereIsMySpoon has quit [Ping timeout: 250 seconds]
mangold has quit [Quit: This computer has gone to sleep]
WhereIsMySpoon has quit [Ping timeout: 250 seconds]
claudiuinberlin has joined #ruby
venmx has quit [Ping timeout: 272 seconds]
ferr has joined #ruby
conta has quit [Ping timeout: 246 seconds]
venmx has joined #ruby
jottr has quit [Ping timeout: 245 seconds]
jottr_ has joined #ruby
BH23 has quit [Ping timeout: 244 seconds]
_joes_ has quit [Ping timeout: 245 seconds]
blaguvest has joined #ruby
mangold has joined #ruby
Swyper has joined #ruby
Inline has joined #ruby
jottr_ is now known as jottr
tdy1 has quit [Ping timeout: 250 seconds]
v01d4lph4 has quit [Remote host closed the connection]
_joes_ has joined #ruby
BH23 has joined #ruby
GodFather has quit [Remote host closed the connection]
WhereIsMySpoon has joined #ruby
WhereIsMySpoon has joined #ruby
WhereIsMySpoon has quit [Changing host]
apparition has quit [Quit: Bye]
dionysus69 has quit [Ping timeout: 246 seconds]
dionysus69 has joined #ruby
yokel has quit [Remote host closed the connection]
yokel has joined #ruby
void09 has left #ruby ["WeeChat 2.3"]
_joes_ has quit [Ping timeout: 255 seconds]
BH23 has quit [Ping timeout: 250 seconds]
_joes_ has joined #ruby
BH23 has joined #ruby
hiroaki has joined #ruby
helpa has quit [Remote host closed the connection]
Hobbyboy has quit [Quit: I think the BNC broke.]
DmitryBochkarev has quit [Remote host closed the connection]
helpa has joined #ruby
DmitryBochkarev has joined #ruby
i1nfusion has quit [Remote host closed the connection]
Hobbyboy has joined #ruby
DmitryBochkarev has quit [Ping timeout: 245 seconds]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
RubyGuyNeedsHelp has quit [Remote host closed the connection]
Swyper has quit [Remote host closed the connection]
i1nfusion has joined #ruby
Swyper has joined #ruby
i1nfusion1 has joined #ruby
tdy1 has joined #ruby
gigetoo has quit [Ping timeout: 255 seconds]
sgen has quit [Ping timeout: 246 seconds]
i1nfusion1 has quit [Remote host closed the connection]
krandi has joined #ruby
APK has joined #ruby
gigetoo has joined #ruby
AKPWD has quit [Ping timeout: 255 seconds]
priodev has quit [Ping timeout: 255 seconds]
n13z has quit [Ping timeout: 246 seconds]
ByronJohnson has quit [Ping timeout: 255 seconds]
ByronJohnson has joined #ruby
n13z has joined #ruby
krandi has quit [Remote host closed the connection]
Onwarion has joined #ruby
priodev has joined #ruby
d10n-work has joined #ruby
polishdub has joined #ruby
kyrylo has joined #ruby
DmitryBochkarev has joined #ruby
APK is now known as AKPWD
Fischmiep has joined #ruby
Devalo has joined #ruby
hiroaki has quit [Ping timeout: 250 seconds]
ams__ has joined #ruby
Devalo has quit [Ping timeout: 250 seconds]
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mangold has quit [Quit: This computer has gone to sleep]
orbyt_ has joined #ruby
orbyt_ has quit [Client Quit]
_joes_ has quit [Ping timeout: 244 seconds]
BH23 has quit [Ping timeout: 250 seconds]
orbyt_ has joined #ruby
terens has joined #ruby
<terens>
hello
alem0lars has joined #ruby
sgen has joined #ruby
aupadhye has quit [Ping timeout: 245 seconds]
<al2o3-cr>
hi
sgen has quit [Ping timeout: 250 seconds]
<terens>
would you store configuration as rows or within jsonb column ?
<terens>
some are depended so ancenstry would be used
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blaguvest has quit [Ping timeout: 245 seconds]
crankharder has quit [Ping timeout: 246 seconds]
crankharder has joined #ruby
lanky_leguan has joined #ruby
clemens3_ has joined #ruby
clemens3 has quit [Ping timeout: 250 seconds]
grilix has joined #ruby
crankharder has quit [Ping timeout: 268 seconds]
aufi has quit [Remote host closed the connection]
cthulchu_ has joined #ruby
clemens3_ has quit [Ping timeout: 246 seconds]
alem0lars has quit [Ping timeout: 250 seconds]
i1nfusion1 has joined #ruby
sanscoeur has joined #ruby
WhereIsMySpoon has quit [Read error: Connection reset by peer]
terens has quit [Quit: Leaving]
Dbugger has quit [Remote host closed the connection]
alem0lars has joined #ruby
Devalo has joined #ruby
sanscoeur has quit [Ping timeout: 246 seconds]
andikr has quit [Remote host closed the connection]
Devalo has quit [Ping timeout: 246 seconds]
alem0lars has quit [Ping timeout: 255 seconds]
crankharder has joined #ruby
gix has joined #ruby
<lanky_leguan>
why do some keywords return something, and some don't? method_name = def name; end but alias doesn't work like that?
Devalo has joined #ruby
<lanky_leguan>
seemed similar, def ~ define_method, alias ~ alias_method
orbyt_ has quit [Ping timeout: 246 seconds]
ferr has quit [Quit: WeeChat 2.4]
ellcs has quit [Remote host closed the connection]
AJA4350 has quit [Remote host closed the connection]
sanscoeur has joined #ruby
AJA4350 has joined #ruby
dar123 has joined #ruby
lanky_leguan has quit [Quit: pro quo]
sanscoeur has quit [Ping timeout: 250 seconds]
sanscoeur has joined #ruby
suukim has joined #ruby
sanscoeur has quit [Read error: Connection reset by peer]
_joes_ has joined #ruby
t0xik has joined #ruby
also_uplime has joined #ruby
TomyWork has quit [Remote host closed the connection]
AJA4350 has quit [Remote host closed the connection]
AJA4350 has joined #ruby
_joes_ has quit [Ping timeout: 246 seconds]
orbyt_ has joined #ruby
AJA4350 has quit [Remote host closed the connection]
also_uplime has quit [Remote host closed the connection]
renich has joined #ruby
claudiuinberlin has joined #ruby
griffindy has joined #ruby
Swyper has quit [Remote host closed the connection]
lxsameer has quit [Quit: out]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
code_zombie has joined #ruby
code_zombie has quit [Client Quit]
Devalo has quit [Remote host closed the connection]
Devalo has joined #ruby
code_zombie has joined #ruby
NickPresta has joined #ruby
jcarl43 has joined #ruby
RedSnarf has joined #ruby
<NickPresta>
Hi. I'm trying to publish a ruby gem with a pre-release version but it seems that running `gem build my.gemspec` results in some sort of transformation happening to my version number. Here's an example of the version, the gemspec, and running `gem build`: https://gist.github.com/nickpresta/fdf77d3f7ada3b9ec5765177d1affdc6. Any explanation would be appreciated. Thanks.
<NickPresta>
I'm reading the RubyGems site: https://guides.rubygems.org/releasing-rubygems/ and the docs claim that gems adhere to semver restrictions, which should mean that something like `1.0.0-beta+exp.sha.5114f85` is a valid version number, but `gem build` throws an error with `Malformed version number string` so I'm not sure where to look to find how I can name beta/pre-release versions correctly.
venmx has quit [Ping timeout: 245 seconds]
griffindy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
terens has joined #ruby
<terens>
why is this code good? scope :holidays, -> { sla_active? ? eval(find_by(key: 'holidays').value) : '' }
Devalo has quit [Remote host closed the connection]
Devalo has joined #ruby
nowhere_man has joined #ruby
r3dc0d3r has quit [Quit: l8a.]
Devalo has quit [Ping timeout: 245 seconds]
RedSnarf has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
claudiuinberlin has joined #ruby
<darix>
terens: something with eval is imho questionable :P
<terens>
but senior dev says that there isn't other way but I don't understand why
<darix>
hmm
<darix>
just based on docs
<darix>
scope :holidays, -> { find_by(key: 'holidays') if sla_active? }
<terens>
Would you choose single vs multiple rows for configuration? With multiple rows I find it hard to do validations. I have run them conditionally on key, also dependend validations are hard. Also frontend has to make lots of PUT requests. Senior dev and other dev agreed that it is better to go multiple rows. They use eval too. Senior said that dependency can be solved by adding ancestry gem and this way we can check.
<terens>
All configurations are STI about 20 models now
<terens>
darix good point
NickPresta has quit [Ping timeout: 256 seconds]
<darix>
terens: although I think where(key: 'holidays') if sla_active?
<darix>
would be better in that case
<terens>
they want a single record although this defeats the purpose of scopes
<terens>
not chainable
<darix>
then you could just define a method on the class
clemens3_ has joined #ruby
zachk has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Devalo has joined #ruby
claudiuinberlin has joined #ruby
reber has joined #ruby
sgen has joined #ruby
Dbugger has joined #ruby
stryek has joined #ruby
suukim has quit [Quit: Konversation terminated!]
ams__ has quit [Quit: Connection closed for inactivity]
Swyper has quit [Remote host closed the connection]
brool has joined #ruby
Swyper has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
venmx has quit [Ping timeout: 246 seconds]
<IGnorAND>
hi
stryek has quit [Quit: Connection closed for inactivity]
<IGnorAND>
I'm trying to run some tests, but they take absurdly long for simple tests. https://pastebin.com/SCr8RRJ9 Is 7 seconds normal or am I exagerating?
<ruby[bot]>
IGnorAND: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
gkos has quit []
Swyper has quit [Remote host closed the connection]