<josealobato>
Thanks Radar, I already read that. I'm trying to go with RSpec instead fo cucumber. I'm looking more about whare the the methods availabe and where and how to set the test files... stuff like that.
venmx has joined #ruby
alfiemax_ has joined #ruby
alfiemax has quit [Ping timeout: 252 seconds]
sytherax_ has joined #ruby
dhollinger has joined #ruby
ryzokuken has joined #ruby
sudorobo has joined #ruby
<josealobato>
In fact I was surprised that their only docs is the cucumber cases. For AC are great but like user documentation is not fantastic.
<Radar>
Maybe it is that way for a reason.
<josealobato>
I guess so.
sytherax_ has quit [Remote host closed the connection]
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sidx64 has joined #ruby
ryzokuken is now known as ryzokuken[zzz]
ryzokuken[zzz] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ARCADIVS has quit [Ping timeout: 245 seconds]
ARCADIVS has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
Mike11 has quit [Read error: Connection reset by peer]
conta has quit [Quit: conta]
conta has joined #ruby
anisha has quit [Ping timeout: 245 seconds]
ciscam has quit [Ping timeout: 260 seconds]
parzydeuko has joined #ruby
ciscam has joined #ruby
clemens3 has quit [Ping timeout: 248 seconds]
karapetyan has joined #ruby
anisha has joined #ruby
mikecmpbll has joined #ruby
kapil___ has joined #ruby
alfiemax_ has quit [Remote host closed the connection]
conta has quit [Ping timeout: 245 seconds]
alfiemax has joined #ruby
alfiemax has quit [Remote host closed the connection]
guille-moe has quit [Quit: guille-moe]
guille-moe has joined #ruby
alfiemax has joined #ruby
clemens3 has joined #ruby
plexigras has joined #ruby
ur5us has quit [Remote host closed the connection]
jamesaxl has joined #ruby
parzydeuko has quit [Ping timeout: 260 seconds]
conta has joined #ruby
josealobato has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
getxsick has joined #ruby
AJA4350 has joined #ruby
sidx64 has quit [Read error: Connection reset by peer]
conta has quit [Ping timeout: 252 seconds]
lxsameer has quit [Ping timeout: 245 seconds]
sidx64 has joined #ruby
conta has joined #ruby
alfiemax_ has joined #ruby
parzydeuko has joined #ruby
amatas has joined #ruby
ciscam has quit [Ping timeout: 245 seconds]
ciscam has joined #ruby
alfiemax has quit [Ping timeout: 245 seconds]
ARCADIVS has quit [Quit: WeeChat 2.0.1]
amatas has quit [Quit: amatas]
amatas has joined #ruby
ta_ has quit [Remote host closed the connection]
suukim has quit [Quit: Konversation terminated!]
roshanavand has quit [Ping timeout: 245 seconds]
chef_byd has joined #ruby
chef_byd has quit [Client Quit]
chef_byd has joined #ruby
chef_byd has quit [Remote host closed the connection]
chef_byd has joined #ruby
josealobato has joined #ruby
conta has quit [Quit: conta]
conta has joined #ruby
andrewvos has joined #ruby
cajone has quit [Ping timeout: 264 seconds]
rawste has joined #ruby
conta has quit [Remote host closed the connection]
conta has joined #ruby
jrafanie has joined #ruby
kliq has quit [Read error: Connection reset by peer]
kliq has joined #ruby
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
getxsick has quit [Ping timeout: 252 seconds]
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Puffball has joined #ruby
sidx64 has joined #ruby
mtkd has quit []
cajone has joined #ruby
Mike11 has joined #ruby
ta_ has joined #ruby
mtkd has joined #ruby
Cavallari has joined #ruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ldnunes has joined #ruby
kmurphy4 has quit [Quit: kmurphy4]
ryzokuken has joined #ruby
sytherax_ has joined #ruby
ectos has quit [Quit: WeeChat 2.1]
Mike11 has quit [Ping timeout: 260 seconds]
plexigras has quit [Quit: WeeChat 2.1]
sytherax_ has quit [Ping timeout: 245 seconds]
plexigras has joined #ruby
alfiemax has joined #ruby
alfiemax_ has quit [Ping timeout: 260 seconds]
stormpack has joined #ruby
alfiemax has quit [Client Quit]
alfiemax has joined #ruby
ectos has joined #ruby
rivalomega has joined #ruby
cschneid has joined #ruby
ectos has quit [Ping timeout: 260 seconds]
rivalomega has quit [Ping timeout: 245 seconds]
ta_ has quit [Ping timeout: 260 seconds]
conta has quit [Remote host closed the connection]
cschneid has quit [Ping timeout: 252 seconds]
conta has joined #ruby
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
synthroid has joined #ruby
ectos has joined #ruby
alfiemax has quit [Ping timeout: 245 seconds]
sidx64 has joined #ruby
quobo has joined #ruby
lxsameer has joined #ruby
duderonomy has joined #ruby
chef_byd has quit [Quit: Leaving]
ryzokuken is now known as ryzokuken[zzz]
ryzokuken[zzz] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
G has quit [Ping timeout: 256 seconds]
G_ has joined #ruby
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Zaab1t has joined #ruby
sidx64 has joined #ruby
sidx64 has quit [Client Quit]
stormpack has quit [Quit: Leaving]
mikecmpbll has quit [Quit: inabit. zz.]
Cavallari has quit [Quit: Cavallari]
ryzokuken has joined #ruby
andrewvos has left #ruby ["WeeChat 2.1"]
mikecmpbll has joined #ruby
oleo has quit [Quit: Leaving]
parzydeuko has quit [Ping timeout: 260 seconds]
oleo has joined #ruby
Bonjourm8 has joined #ruby
getxsick has joined #ruby
getxsick has quit [Client Quit]
ta_ has joined #ruby
Sembei has joined #ruby
conta has quit [Remote host closed the connection]
Pisuke has quit [Ping timeout: 260 seconds]
donofrio has joined #ruby
warrshrike has joined #ruby
<warrshrike>
is there a queue like thing of fixed size which autoremoves the oldest element when a newer is pushed and size is full?
<yoones>
Hi! I'm struggeling with bigdecimal stuff. Ruby keeps rounding values when I don't want it to. I even tried to put my value into a string (works well), but then when I add .to_i it rounds it anyway. How can I prevent this behavior?
<elomatreb>
yoones: #to_i converts to an integer, which necessarily rounds
<yoones>
I tried #floor and #ceil, both round at some point
<yoones>
how can I get rid of the decimal part of a number?
<yoones>
without rounding
<yoones>
truncate also rounds
<yoones>
-_-'
al2o3-cr has quit [Quit: WeeChat 2.1]
aufi has quit [Quit: Leaving]
ilikecakeandpie has joined #ruby
<canton7>
how do you get rid of the decimal part of a number *without* rounding?
netfrog has joined #ruby
karapetyan has quit [Remote host closed the connection]
<apeiros>
or rather: floor is "round down" and ceil is "round up"
<apeiros>
yoones: how about you make an actual, reproducible, small example
<elomatreb>
Yeah. Input, and expected output
<yoones>
floor doesn't work for me
<canton7>
you're going to have to explain why... an example is a good way to do that
mahlon has quit [Quit: WeeChat 2.1]
conta has quit [Ping timeout: 260 seconds]
<apeiros>
yoones: "doesn't work" as a problem description doesn't work.
<yoones>
I basicaly need to do: expect((big_decimal_value * 100).truncate).to eq(csv_value)
<canton7>
right, and what's 'big_decimal_value' and 'csv_value'?
<yoones>
I receive a CSV extracted from an Excel file
<yoones>
2 sec
<apeiros>
we do not care about the csv. extract the value and make the example without needing the csv.
darkhanb has joined #ruby
<elomatreb>
Alternative possibility: You are sure you convert the CSV value to an appropriate type (as it's probably originally a String)? Ruby does not do implicit typecasts like some other scripting languages
<apeiros>
since the letters 1 followed by 2 is not the same as the value twelve.
karapetyan has joined #ruby
<yoones>
elomatreb, Yes, I'm comparing BigDecimal.new(csv_extracted_value, 14) with another BigDecimal value
guille-moe has quit [Ping timeout: 245 seconds]
<yoones>
elomatreb, The problem I encounter is that the excel-extracted value has been truncated, and I'm comparing it to a ruby-computed result with more precision
<yoones>
Trying to truncate it, it gets rounded, which make my life miserable
<yoones>
makes*
<apeiros>
yeah, no, BigDecimal#truncate does not round. it truncates.
sytherax_ has quit [Remote host closed the connection]
sytherax_ has joined #ruby
rawste has joined #ruby
amar has quit [Ping timeout: 252 seconds]
DeepIO has joined #ruby
DeepIO has quit [Max SendQ exceeded]
alfiemax has joined #ruby
conta has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
ilikecakeandpie has quit [Quit: ilikecakeandpie]
rawste has quit [Quit: That's all folks!]
sphenxes has joined #ruby
WAFFLEMAKER3000 has quit [Ping timeout: 252 seconds]
sphenxes has quit [Remote host closed the connection]
kapil___ has quit [Quit: Connection closed for inactivity]
<Eiam>
do people here actually depend on the system ruby to do anything? like the default version of ruby that ships with macOS for example
<Eiam>
when I was first getting started I used it, then i moved to rvm, later rbenv, and it seems like most developers stop using the system version of interpreters when they move into actually using the language. wondering if I'm the exception
<elomatreb>
It really depends on your OS, e.g. on Arch we don't really have outdated rubies
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
venmx has quit [Ping timeout: 264 seconds]
<Eiam>
well depending on the OS version means at some point your software will be used with something you didnt' test it with either ?
<Eiam>
im wondering aloud if it would matter if OSes stopped shipping with interpreters out of the box
nowhere_man has joined #ruby
sidx64 has joined #ruby
seabee has joined #ruby
<elomatreb>
You have to specify the version in some form anyway, if you don't depend on the OS version you have to either mention it in a readme or include it in some machine-readable form for the people who manually install/build (or use a tool) Ruby
alfiemax has quit [Remote host closed the connection]
ilikecakeandpie has joined #ruby
<elomatreb>
It would matter, probably not so much in Rubies case but e.g. python and even the shells are essential for OSes
<apeiros>
Eiam: I'm on osx and I don't touch system ruby. and I think wouldn't on any box I haven't tailor-made for some purpose.
sytherax_ has quit [Remote host closed the connection]
sidx64 has quit [Client Quit]
coderphive has joined #ruby
nicesignal has quit [Remote host closed the connection]
nicesignal has joined #ruby
chouhoul_ has joined #ruby
amar has joined #ruby
chouhoulis has quit [Ping timeout: 252 seconds]
<Eiam>
elomatreb: generally one would bundle their dependencies that are relevant to control
<Eiam>
i.e. if you depend on ruby 2.3 you should bundle ruby 2.3
amar has quit [Ping timeout: 252 seconds]
<Eiam>
elomatreb: same problem exists for python, python 2 vs python 3, etc
<elomatreb>
That gets you the node-ism of endless duplicates of stuff
<Eiam>
elomatreb: the file system can de-dupe that stuff for you if its that big of a deal
<Eiam>
but disk space is pretty cheap these days
yohji has quit [Remote host closed the connection]
<elomatreb>
Not just the pure space. I recently ran out of inodes on a partition because I had a few larger node_modules directories on it
<apeiros>
elomatreb: lulwot? :D
<elomatreb>
yeah
<Eiam>
we can find edge cases for any scenario, i don't think thats terribly common or worth hand wringing
<elomatreb>
Weird as hell to debug, because none of the tools give proper error messages
<Eiam>
the OS already doesn't provide node dependencies, no OS does
<Eiam>
every app is required to bring those along with them.
<Eiam>
or bring a way to install them
<elomatreb>
I'm not against ecosystem-specific dependency management, but saying "just bundle it and ship" is unnecessarily wasteful
<elomatreb>
Not everyone can just hit the "give larger instance" button on $cloudProvider
<Eiam>
I fail to see how its wasteful , ruby is 50kb
<Eiam>
thats effectively 'nothing' even if you have 1000 apps require it
ta_ has joined #ruby
nowhere_man has quit [Ping timeout: 260 seconds]
amar has joined #ruby
alfiemax has joined #ruby
kmurphy4 has quit [Remote host closed the connection]
karapetyan has quit [Remote host closed the connection]
slash_nick has joined #ruby
RougeR has quit [Ping timeout: 260 seconds]
amar has quit [Ping timeout: 252 seconds]
mtkd has quit [Ping timeout: 252 seconds]
<havenwood>
Eiam: On OSes that have nice up-to-date Ruby packages, I often use those. When you're on a dev machine with multiple legacy apps, some are always going to be on some Ruby enging/version. For that case, it's nice to be able to use system Ruby or one of your choosing.
<quuxman>
so Ruby strongly discourages functional programming, at least syntactically. It's pretty weird having a dynamic language treat function variables specially, but I suppose it's the ambiguous call syntax that makes the whole mess
nickjj has quit [Read error: Connection reset by peer]
<havenwood>
`.:` is better than `->` ~Matz
<elomatreb>
There's nothing special about "function variables", they're regular instances of the Method class
sytherax_ has joined #ruby
nickjj has joined #ruby
cyberg has joined #ruby
<havenwood>
quuxman: Would you consider this syntax to no longer be discouraging functional programming?: Foo.map &BazModule.:bar
<havenwood>
quuxman: You might get a Christmas present.
<havenwood>
I'd love that, personally.
<elomatreb>
Will that be sugar for .method, or do something "special"?
<quuxman>
what's the ampersand?
<elomatreb>
It calls #to_proc on the given object, so the method receives a block it can yield to
<havenwood>
quuxman: It passes a proc as a block.
guacamole has joined #ruby
guacamole has joined #ruby
guacamole has quit [Changing host]
<elomatreb>
E.g. Symbol#to_proc returns a proc that sends itself (the Symbol) to the yielded object
<quuxman>
I read a whole article about the difference between procs and blocks, and I'm not any more clear on them
<elomatreb>
It mostly doesn't matter, because very few people are clear on them so they're used interchangeable
<havenwood>
elomatreb: Yeah, it's just a patch to parse.y that calls the "method" method.
<havenwood>
I wonder if I'd prefer #public_method.
* havenwood
ponders
<elomatreb>
They only difference you do sometimes need to worry about is between procs and lambdas concerning the behavior of returns and breaks
cyberg has quit [Ping timeout: 245 seconds]
<elomatreb>
Yeah, it should obey visibility restrictions by default (I take it regular #method does not?)
seabee has quit [Quit: leaving]
alfiemax has joined #ruby
ta_ has joined #ruby
cyberg has joined #ruby
alfiemax has quit [Ping timeout: 252 seconds]
schneider has joined #ruby
pastorinni has joined #ruby
ipeee has quit [Read error: Connection reset by peer]
sumobob has joined #ruby
nowhere_man has joined #ruby
white_lilies has joined #ruby
kmurphy4 has joined #ruby
<quuxman>
ok good to know. So what would leaving out the ampersand do? For example `foo.map(method(:bar))`?
<apeiros>
it would call the method map with a single argument
<elomatreb>
It's like saying foo.map(12)
<apeiros>
that argument usually being an instance of Method, but really, depends on what self.method(:bar) in that context returns (like all implicit method calls)
Zaab1t has quit [Quit: Zaab1t]
* apeiros
nitpicks: it's like saying foo.map(bar(12))
<apeiros>
oh well, that could be misconstrued. it's like: foo.map(blupp(:bar))
cagomez has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
<elomatreb>
I meant in the sense that it's an invalid/nonsensical usage, and will error
<quuxman>
so how is the ampersand not redundant?
schleppel has quit [Quit: Konversation terminated!]
<apeiros>
that depends on what foo.map does :)
<apeiros>
but sure, Enumerable#map will bomb
<quuxman>
and what is "blupp"? where did that come from?
<apeiros>
it's a stand in for "you're calling a method"
cyberg has quit [Ping timeout: 256 seconds]
mtkd has quit []
<ELLIOTTCABLE>
o7 all
<quuxman>
on what? Leaving out the ampersand somehow makes an implicit method call on some object?
<apeiros>
no
<ELLIOTTCABLE>
I haven't written Ruby in … a miiiiinute
<ELLIOTTCABLE>
(ten years???)
<apeiros>
it's never "on some object", and it's a method call with the ampersand too.
<apeiros>
method calls without receiver are always on self.
<ELLIOTTCABLE>
I can't, for the life of me, remember how to “open” (in the OCaml sense) a module in Ruby
<havenwood>
quuxman: In Ruby a block is a special thing. It often doesn't have an object allocated. You can pass a proc or method object as a block with &.
<apeiros>
and what a method does always depends on the receiver.
<havenwood>
ELLIOTTCABLE: You can just reopen the module like: module Foo; ... end
sagax has joined #ruby
physicist__ has quit [Quit: leaving]
<quuxman>
havenwood: ah ok.
<apeiros>
meaning: foo.map may or may not be Enumerable#map. method(:bar) may or may not be Object#method.
<ELLIOTTCABLE>
if I have `require 'CoolProj'` and a lot of `CoolProj::Blah.new`,
<ELLIOTTCABLE>
how can I stop typing `CoolProj::` every three seconds in a consuming file?
<apeiros>
but maybe we can change this to something which makes more sense to you: `foo.map(method(:bar))` is the same as `some_arg = method(:bar); foo.map(some_arg)`
<quuxman>
So what if I make a def at the top level, like `def foo(x) put x end` and then call it with `foo x`. If everything is a method call, what object is receiving foo?
solocshaw has joined #ruby
<apeiros>
self
<havenwood>
ELLIOTTCABLE: Assuming it's a module: include CoolProj
<apeiros>
as said before: methods invoked without an explicit receiver are always sent to self.
<ELLIOTTCABLE>
even at the root level of a file?
<quuxman>
what's self at the top level?
<apeiros>
just ask it
<havenwood>
ELLIOTTCABLE: You can include at any level. It depends on what you're doing.
<apeiros>
(main, an instance of Object)
<havenwood>
>> class << self; undef inspect end; self
<ruby[bot]>
havenwood: # => /tmp/execpad-5caf97649c93/source-5caf97649c93:1:in `p': undefined method `inspect' for #<Object:0x40 ...check link for more (https://eval.in/1007801)
<quuxman>
heh. main is not defined, because presumably it's referencing main.main
<ELLIOTTCABLE>
specifically, at the moment, in specs
solocshaw has quit [Client Quit]
<havenwood>
quuxman: main is an instance of Object that likes to call itself "main"
<elomatreb>
But there isn't anything really special about it otherwise