<freedrull>
bringing it back to testing this, i'm guessing you would stub out the soundcloud library? i would probably just stub out the network with VCR or webmock
<ljarvis>
haarchri: what have you tried so far?
<ljarvis>
freedrull: I'd also just use vcr
<ljarvis>
freedrull: but you have the option to unit test it if you want (there's really not much point, though)
<ljarvis>
haarchri: this uses String#scan with the same regexp
[spoiler] has joined #ruby-lang
charliesome has quit [Ping timeout: 272 seconds]
benlovell has quit [Ping timeout: 245 seconds]
rbrs has joined #ruby-lang
<haarchri>
ahh so easy ... thank you =)
Hanmac has joined #ruby-lang
benlovell has joined #ruby-lang
dagda1 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Hanmac>
hm i have problems with my binding, i could pinpoint it to a function in the C-API with RCLASS_SUPER ... the problem i have which that, since when does that return an Enumerable or something like that? because i got a included module instead of the parent class i suspected ...
ta has quit [Ping timeout: 244 seconds]
kiyote23 has joined #ruby-lang
lapide_viridi has joined #ruby-lang
marr has quit [Ping timeout: 245 seconds]
mcclurmc has joined #ruby-lang
kiyote23 has quit [Ping timeout: 255 seconds]
tmi1 has joined #ruby-lang
mcclurmc has quit [Ping timeout: 244 seconds]
bmichelsen has joined #ruby-lang
yfeldblum has joined #ruby-lang
ledestin has joined #ruby-lang
rbrs has quit [Quit: Leaving]
mistym has quit [Remote host closed the connection]
lapide_viridi has quit [Quit: Leaving]
charliesome has joined #ruby-lang
yfeldblum has quit [Ping timeout: 264 seconds]
yfeldblum has joined #ruby-lang
hakunin has quit []
rbrs has joined #ruby-lang
yock has joined #ruby-lang
micmus has quit [Ping timeout: 256 seconds]
yusuf1 has quit [Quit: Leaving.]
yock has quit [Ping timeout: 244 seconds]
Menorah has quit [Quit: This computer has gone to sleep]
Miphix has joined #ruby-lang
ta has joined #ruby-lang
dagda1 has joined #ruby-lang
fclausen has quit [Ping timeout: 272 seconds]
tmi1 has quit [Quit: Leaving.]
Blackhol_ has joined #ruby-lang
ta has quit [Ping timeout: 244 seconds]
apeiros_ has quit [Remote host closed the connection]
apeiros_ has joined #ruby-lang
fclausen has joined #ruby-lang
<haarchri>
mhm when i "Push" ifconfig to the scan with an string ... the match_array is empty :/ https://eval.in/238333 .. output is []
<ljarvis>
haarchri: check that 'str' actually has `P-t-P`
<ljarvis>
my ifconfig for example does not
Thecrazylumberja has joined #ruby-lang
Thecrazylumberja has quit [Client Quit]
dagda1 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<apeiros_>
\K ?
tmi1 has joined #ruby-lang
<apeiros_>
haarchri: if you gist the contents of ifconfig along with the output you expect, we can help better.
<ljarvis>
apeiros_: scroll up
* apeiros_
yawns & scrolls
<apeiros_>
good morning btw.
<ljarvis>
psh it's past morning where you live
fclausen has quit [Ping timeout: 272 seconds]
<apeiros_>
if you go to sleep at 0500, it is morning
<ljarvis>
:)
<ljarvis>
that's late
<ljarvis>
working or partying?
<apeiros_>
holidays
<apeiros_>
happens every time
<apeiros_>
hm, don't see an explanation of \K, but found the contents :)
<apeiros_>
didn't find the expected output either :-|
<apeiros_>
egg & beacon? hmmm…
<ljarvis>
am now hungry
<apeiros_>
btw. ljarvis - do you have an opinion on postgres composite types vs. just using multiple columns? I'm experimenting and not quite sure I like composite types.
marr has joined #ruby-lang
<ljarvis>
apeiros_: I think composite types are useful, but most people will just reach for multiple columns. Not really a reason to use one or the other really, though
charliesome has quit [Read error: Connection reset by peer]
charliesome has joined #ruby-lang
mcclurmc has joined #ruby-lang
<ljarvis>
plus extracting composite columns is a bit ugly imo
<apeiros_>
so far the only advantage I see is that it makes it easier to figure what belongs together
<apeiros_>
on the other hand, it makes it a lot harder to use things like bind variables
<ljarvis>
yep
<apeiros_>
I mean, I solved that part, but it made the code a bit more complex
iamninja has quit [Quit: ZZZzzz…]
mcclurmc has quit [Ping timeout: 240 seconds]
<Hanmac>
apeiros_: i remember long time ago there was a snack which has the three most important eating stuff inside and all begins with B, it had "Beef, Beans and Beacon" ;P
<ljarvis>
:/
<apeiros_>
any column types you wish you had native support for by the orm?
<ljarvis>
what do they currently support? just all simple types?
<apeiros_>
file is a composite of exists:boolean, name:varchar, path:varchar, size:bigint, content_type:varchar, fingerprint:varchar, updated_at:timestamp with time zone
<apeiros_>
money is a composite of amount:decimal, currency:varchar(3). pondering on whether I should use money instead of decimal
<apeiros_>
json uses pg's jsonb type. the rest is self explanatory I guess
<ljarvis>
right, you got more than I expected already
<apeiros_>
ah, password.unencrypted is only available when you assigned the plaintext pw to it
<ljarvis>
interval is one i use often i guess
<apeiros_>
it only stores the pw hash, of course
<ljarvis>
then you have all the range types and net stuff, which is all probably overkill
<apeiros_>
interval & net would probably be relatively easy. range seems quite hard
ta has joined #ruby-lang
<apeiros_>
array types seem to be pretty hard too. at least I have no good idea on how to populate any nested ones.
<ljarvis>
maybe it could be pluggable? the geo stuff could also be done, but maybe it doesn't need to be in core
<apeiros_>
geo is something I definitively plan to add
<ljarvis>
ah ok
<apeiros_>
yeah, adding more column types isn't hard. all you need to do is define the column class.
ta has quit [Ping timeout: 244 seconds]
<apeiros_>
ah, the other problem with composite types: adding checks is harder
[spoiler] has quit [Quit: Leaving]
dagda1 has joined #ruby-lang
cantonic has quit [Quit: cantonic]
<ljarvis>
apeiros_: maybe you should expose it to the wild before custom type like composite types ;)
<apeiros_>
I'm timid ;-)
cantonic has joined #ruby-lang
g0bl1n has joined #ruby-lang
g0bl1n has quit [Changing host]
g0bl1n has joined #ruby-lang
<ljarvis>
psh
VictorBjelkholm has joined #ruby-lang
<apeiros_>
haarchri: have you solved your problem yet?
ta has joined #ruby-lang
ta has quit [Ping timeout: 240 seconds]
kiyote23 has joined #ruby-lang
<ljarvis>
really tempted to move all my mail to fastmail...
<apeiros_>
I'm still pondering on doing it on my own again. but the effort…
<ljarvis>
yeah i thought about it too, but i don't have the patience. I'm happy to pay for a decent service
<apeiros_>
I really dislike the idea of having so little control over something as important as email. but the advantage of e.g. googles defense mechanisms is hard to beat.
<ljarvis>
agreed, i really want everything off of google, though
<ljarvis>
i have an icloud account, but i'd rather have my email unassociated with everything else. Google and Apple are both "all or nothing" services
rahul_j has quit [Quit: rahul_j]
yfeldblum has quit [Ping timeout: 245 seconds]
rahul_j has joined #ruby-lang
kiyote23 has quit [Ping timeout: 272 seconds]
<yorickpeterse>
darn it, seems my lame #code2014 troll attempts have not worked as much as I wanted to :<
<darix>
apeiros_: postfixadmin+dovecot+postfix ... it isnt that hard anymore.
<ljarvis>
yorickpeterse: you gotta be more obvious, everyone writes fortran
<apeiros_>
darix: that's what I will install
<apeiros_>
but not sure I will run it for all my private mail
<yorickpeterse>
ljarvis: I was hoping ALGOL would do it
<apeiros_>
I don't think I have the knowledge to properly "defend" my mailservers
<darix>
apeiros_: mailbox.org is run by heinlein (he wrote the books for dovecot and postfix)
<darix>
yorickpeterse: cobal60
<darix>
cobol even
<darix>
or the basic for kc85/4
<zenspider>
I've done fortran in the past 10 years...
<darix>
zenspider: you also have done phuby. so we didnt expect anything else
rahul_j has quit [Quit: rahul_j]
<zenspider>
where done == debugged some code for my BFF who's a nuclear chemist.
<yorickpeterse>
darix: COBOL was in my list
<zenspider>
tho I also helped get RubyInline::Fortran working
<zenspider>
so you could write your tests in ruby and run them against your fortran :)
Kingpin_ has joined #ruby-lang
<zenspider>
aja was one of the 2-3 for forth
mcclurmc has joined #ruby-lang
<zenspider>
oops. not forth... prolog
judofyr has joined #ruby-lang
mcclurmc has quit [Ping timeout: 264 seconds]
rippa has joined #ruby-lang
oleo__ has joined #ruby-lang
oleo is now known as Guest3962
Guest3962 has quit [Ping timeout: 245 seconds]
bmichelsen has quit [Quit: ZZZzzz…]
oleo__ has quit [Quit: Verlassend]
ta has joined #ruby-lang
cantonic has quit [Read error: Connection reset by peer]
cantonic has joined #ruby-lang
ItSANgo has quit [Quit: Leaving...]
ta has quit [Ping timeout: 265 seconds]
oleo__ has joined #ruby-lang
j4cknewt has joined #ruby-lang
TvL2386 has joined #ruby-lang
Cakey has joined #ruby-lang
Cakey has quit [Client Quit]
Cakey has joined #ruby-lang
Cakey has quit [Client Quit]
Cakey has joined #ruby-lang
Cakey has quit [Client Quit]
Cakey has joined #ruby-lang
Cakey has quit [Client Quit]
Cakey has joined #ruby-lang
Cakey has quit [Client Quit]
Cakey has joined #ruby-lang
Cakey has quit [Client Quit]
arBmind has joined #ruby-lang
dragonkh has joined #ruby-lang
dragonkh has quit [Client Quit]
dragonkh has joined #ruby-lang
dragonkh has left #ruby-lang [#ruby-lang]
duderonomy has quit [Ping timeout: 272 seconds]
yfeldblum has joined #ruby-lang
Liquori has joined #ruby-lang
setanta__ has joined #ruby-lang
g0bl1n has quit [Ping timeout: 255 seconds]
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<apeiros_>
and you can construct those objects before passing them in
<apeiros_>
not sure what precisely you want to pass in, but it seems like you want: arg = {}; attack_modes_names.each do |key, value| arg[key] = column_content(node, value); end; attack_modes_data << AttackMode.new(arg)
<apeiros_>
(this can be written in nicer ways - but sticking close to your code for better understanding)
<apeiros_>
and puts is there to print stuff to $stdout. it's not there to "put data into a function".
dagda1 has joined #ruby-lang
kiyote23 has quit [Remote host closed the connection]
<RbLeif>
ok thank you I'll try it
Bwild has joined #ruby-lang
TvL2386 has quit [Read error: Connection reset by peer]
scampbell has joined #ruby-lang
shambrarian has joined #ruby-lang
ta has joined #ruby-lang
Hanmac has joined #ruby-lang
<RbLeif>
apeiros_: It works, thank you !
Blackhol_ has quit [Remote host closed the connection]
nofxx has joined #ruby-lang
ta has quit [Ping timeout: 272 seconds]
whippythellama has joined #ruby-lang
dagda1 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Bwild has quit [Ping timeout: 245 seconds]
shambrarian has quit [Changing host]
shambrarian has joined #ruby-lang
tmi1 has quit [Quit: Leaving.]
enebo has joined #ruby-lang
Miphix has quit [Quit: Leaving]
ta has joined #ruby-lang
enebo has quit [Client Quit]
Bwild has joined #ruby-lang
ta has quit [Ping timeout: 256 seconds]
yxhuvud has joined #ruby-lang
ta has joined #ruby-lang
Bwild has quit [Ping timeout: 255 seconds]
ta has quit [Ping timeout: 240 seconds]
charliesome has quit [Quit: zzz]
dagda1 has joined #ruby-lang
rbrb has joined #ruby-lang
dagda1 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ta has joined #ruby-lang
yfeldblum has joined #ruby-lang
rbrb has quit [Remote host closed the connection]
rbrb has joined #ruby-lang
rbrb has quit [Remote host closed the connection]
mcclurmc has joined #ruby-lang
rbrb has joined #ruby-lang
ta has quit [Ping timeout: 265 seconds]
yfeldblum has quit [Ping timeout: 244 seconds]
rbrb has quit [Read error: Connection reset by peer]
rbrb has joined #ruby-lang
rbrb has quit [Read error: Connection reset by peer]
rbrb has joined #ruby-lang
judofyr has quit [Remote host closed the connection]
rbrb has quit [Read error: Connection reset by peer]
rbrb has joined #ruby-lang
rbrb has quit [Read error: Connection reset by peer]
rbrb has joined #ruby-lang
[spoiler] has quit [Quit: Leaving]
rbrb has quit [Remote host closed the connection]
rbrb has joined #ruby-lang
rbrb has quit [Remote host closed the connection]
Lewix has quit [Remote host closed the connection]
rbrb has joined #ruby-lang
ruby-lang036 has joined #ruby-lang
<ruby-lang036>
hello
<ruby-lang036>
ok
<bradland>
hiya
loincloth has joined #ruby-lang
dagda1 has joined #ruby-lang
Lewix has joined #ruby-lang
rbrb has quit [Remote host closed the connection]
yock has joined #ruby-lang
mcclurmc_ has joined #ruby-lang
mcclurmc has quit [Ping timeout: 244 seconds]
ruby-lang036 has quit [Ping timeout: 246 seconds]
yock has quit [Ping timeout: 245 seconds]
rahul_j has quit [Quit: rahul_j]
rahul_j has joined #ruby-lang
AmirolAhmad has joined #ruby-lang
Blackhol_ has joined #ruby-lang
arooni-mobile has joined #ruby-lang
[H]unt3r has joined #ruby-lang
maso has quit [Remote host closed the connection]
klmlfl has joined #ruby-lang
nathanstitt has quit [Quit: I growing sleepy]
cmhobbs has joined #ruby-lang
yfeldblum has joined #ruby-lang
whippythellama has quit [Quit: whippythellama]
whippythellama has joined #ruby-lang
cornerma1 has joined #ruby-lang
mcclurmc has joined #ruby-lang
haarchri_ has joined #ruby-lang
yfeldblum has quit [Ping timeout: 258 seconds]
cornerman has quit [Ping timeout: 240 seconds]
cornerma1 is now known as cornerman
haarchr__ has joined #ruby-lang
kiyote23 has joined #ruby-lang
haarch___ has joined #ruby-lang
mcclurmc_ has quit [Ping timeout: 244 seconds]
haarchri has quit [Ping timeout: 244 seconds]
ruby-lang86 has joined #ruby-lang
nathanstitt has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
haarchr__ has quit [Ping timeout: 244 seconds]
haarchri_ has quit [Ping timeout: 265 seconds]
rahul_j has joined #ruby-lang
petete has joined #ruby-lang
havenwood has joined #ruby-lang
jemc has joined #ruby-lang
petete has left #ruby-lang [#ruby-lang]
kiyote23 has quit [Remote host closed the connection]
petete has joined #ruby-lang
kiyote23 has joined #ruby-lang
benlovell has quit [Ping timeout: 265 seconds]
benlovell has joined #ruby-lang
<yorickpeterse>
> open a random spec
<yorickpeterse>
428 characters on several lines
<yorickpeterse>
(so everal lines with that char amount)
<yorickpeterse>
._.
petete has left #ruby-lang ["WeeChat 1.0.1"]
mostlybadfly has joined #ruby-lang
<yorickpeterse>
something something line-wrapping is a difficult thing apparently
ikrima has joined #ruby-lang
migbar has joined #ruby-lang
g0bl1n has joined #ruby-lang
micmus has joined #ruby-lang
migbar has quit [Client Quit]
benlovell has quit [Ping timeout: 245 seconds]
wallerdev has joined #ruby-lang
RbLeif has quit [Read error: Connection reset by peer]
linc01n has quit [Ping timeout: 258 seconds]
awheeler has joined #ruby-lang
<apeiros_>
but yorickpeterse, that would barely fill a full screen width…
linc01n has joined #ruby-lang
RbLeif has joined #ruby-lang
jemc has quit [Quit: WeeChat 1.0.1]
<ljarvis>
heh
<yorickpeterse>
Yup, I made a ticket for it so that when the dude who wrote it comes back from holidays we can fix it togheter
<yorickpeterse>
* together
<yorickpeterse>
because also a bunch of specs fail
<yorickpeterse>
and the example blocks are massive
<yorickpeterse>
and I have no idea what it does
yfeldblum has joined #ruby-lang
<yorickpeterse>
oh ffs, the data has been copy-pasted into a bunch of other specs as well
matti has joined #ruby-lang
SHyx0rmZ has joined #ruby-lang
<yorickpeterse>
I hate to play a fucking dictator at the office but it seems I need to whip people more often
<yorickpeterse>
there, xdescribe all the things
Iskarlar has quit [Read error: Connection reset by peer]
jemc has joined #ruby-lang
Iskarlar has joined #ruby-lang
webhat has joined #ruby-lang
judofyr has joined #ruby-lang
stamina has quit [Ping timeout: 255 seconds]
yfeldblum has quit [Ping timeout: 255 seconds]
michaeldeol has joined #ruby-lang
Iskarlar has quit [Client Quit]
haarch___ has quit []
RbLeif has quit [Remote host closed the connection]
fusillicode has joined #ruby-lang
ta has joined #ruby-lang
diegoviola has joined #ruby-lang
bb010g has joined #ruby-lang
kiyote23 has quit [Remote host closed the connection]
fusillicode has quit [Ping timeout: 240 seconds]
sideshowcoder has quit [Quit: Cheers!]
ta has quit [Ping timeout: 256 seconds]
<ljarvis>
>> class Numeric; def !; downto(1).inject(:*); end; end; 5.!
Lewix has quit [Remote host closed the connection]
sideshowcoder has joined #ruby-lang
nathanstitt has quit [Quit: I growing sleepy]
fusillicode has joined #ruby-lang
mattwildig has joined #ruby-lang
chouhoul_ has joined #ruby-lang
chouhou__ has joined #ruby-lang
chouhoul_ has quit [Read error: Connection reset by peer]
wallerdev has quit [Quit: wallerdev]
chouhoulis has quit [Ping timeout: 244 seconds]
yock has joined #ruby-lang
RbLeif has joined #ruby-lang
Lewix has joined #ruby-lang
Lewix has quit [Changing host]
Lewix has joined #ruby-lang
[H]unt3r has quit [Quit: Leaving]
mattwildig has quit [Ping timeout: 240 seconds]
jemc has quit [Ping timeout: 244 seconds]
awheeler has quit [Remote host closed the connection]
yock has quit [Ping timeout: 250 seconds]
mattwildig has joined #ruby-lang
petete has joined #ruby-lang
lapide_viridi has joined #ruby-lang
hotpancakes has joined #ruby-lang
j4cknewt_ has joined #ruby-lang
j4cknewt has quit [Read error: Connection reset by peer]
VictorBjelkholm has quit [Remote host closed the connection]
yfeldblum has joined #ruby-lang
benlovell has joined #ruby-lang
wallerdev has joined #ruby-lang
GBrawl has joined #ruby-lang
benlovell has quit [Ping timeout: 244 seconds]
yfeldblum has quit [Ping timeout: 272 seconds]
[spoiler] has joined #ruby-lang
slawrence00 has joined #ruby-lang
diegoviola has quit [Quit: WeeChat 1.0.1]
ta has joined #ruby-lang
j4cknewt_ has quit [Ping timeout: 245 seconds]
j4cknewt has joined #ruby-lang
j4cknewt has quit [Read error: Connection reset by peer]
j4cknewt has joined #ruby-lang
lapide_viridi has quit [Quit: Leaving]
ta has quit [Ping timeout: 256 seconds]
Iskarlar has joined #ruby-lang
arBmind1 has joined #ruby-lang
diegoviola has joined #ruby-lang
revath has joined #ruby-lang
arBmind has quit [Ping timeout: 264 seconds]
stamina has joined #ruby-lang
ur5us has joined #ruby-lang
AmirolAhmad has quit []
hahuang62 has joined #ruby-lang
hotpancakes has quit [Remote host closed the connection]
pwnz0r has joined #ruby-lang
chouhou__ has quit [Read error: Connection reset by peer]
hahuang62 has quit [Client Quit]
hahuang62 has joined #ruby-lang
chouhoulis has joined #ruby-lang
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby-lang
amystephen has quit [Ping timeout: 265 seconds]
ta has joined #ruby-lang
mcclurmc has quit [Remote host closed the connection]
kiyote23 has joined #ruby-lang
kiyote23 has quit [Remote host closed the connection]
ta has quit [Ping timeout: 244 seconds]
Liquori has quit [Read error: Connection reset by peer]
j4cknewt_ has joined #ruby-lang
Liquori has joined #ruby-lang
mistym has joined #ruby-lang
j4cknewt has quit [Ping timeout: 258 seconds]
RbLeif has quit [Remote host closed the connection]
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
marr has quit [Ping timeout: 245 seconds]
yatish27 has quit [Remote host closed the connection]
ta has joined #ruby-lang
mattwildig has quit []
yfeldblum has joined #ruby-lang
RbLeif has joined #ruby-lang
ta has quit [Ping timeout: 244 seconds]
Kabaka has quit [Read error: Connection reset by peer]
j4cknewt has joined #ruby-lang
yfeldblum has quit [Ping timeout: 244 seconds]
j4cknewt_ has quit [Read error: Connection reset by peer]
michaeldeol has joined #ruby-lang
__butch__ has joined #ruby-lang
micmus has quit [Ping timeout: 244 seconds]
ta has joined #ruby-lang
rbrs has quit [Remote host closed the connection]
JohnBat26 has joined #ruby-lang
mustmodify has joined #ruby-lang
j4cknewt has quit [Read error: Connection reset by peer]
j4cknewt has joined #ruby-lang
micmus has joined #ruby-lang
kiyote23 has joined #ruby-lang
yatish27 has joined #ruby-lang
RobertBirnie has joined #ruby-lang
revath has quit [Read error: Connection reset by peer]
tkuchiki has quit [Remote host closed the connection]
rcvalle has joined #ruby-lang
tkuchiki has joined #ruby-lang
<mustmodify>
Ruby geniuses... I patched Numeric so that I could set a "scale" attribute. I patched Numeric#to_s to respect that scale attribute, so I could see 20.to_s => '20' and other times 20.tap{|n| n.scale = 3}.to_s == 20.000. But now numbers are frozen. Should I create a wrapper class? Seems like a mess just for some formatting. Should I add view helpers and try to remember to use that everywhere in my app? Ouch. https://gist.github.com/mustmodify/564ec7886d
<mustmodify>
ljarvis: Well, in Ruby 2 numerics are frozen so I can't do that anyway. It worked perfectly well, though. If I wrap it, should I just 'method missing' everything? That seems ... sloppy
tkuchiki has quit [Ping timeout: 240 seconds]
<ljarvis>
mustmodify: use delegator then?
<headius>
why do you need to keep the scale on the number?
<headius>
mutable state on a number seems like a big risk
<judofyr>
class ScaledNumber; def initialize(num, scale = 1); … end end
<ljarvis>
^ that's what I'd do
<ljarvis>
separate this stuff
<judofyr>
or: Scales = {}
ta has quit [Ping timeout: 265 seconds]
<mustmodify>
headius: these are medical values. It doesn't make sense to report three decimal places for something that's measured on one... similarly, if I report 3 for 3.000, physicians scratch their heads and assume we were sloppy and didn't measure to the correct precision.
<judofyr>
mustmodify: but do you really want to define a scale value for *every* number?
<judofyr>
doesn't it work more like ranges?
<judofyr>
oh, I see
<judofyr>
I think
<judofyr>
you get the number and the scale from some database?
RbLeif has quit []
<mustmodify>
judofyr: generally we get the number ( and an associated normal range ) from one source. Then we'll convert units if needed. Each ( unit x measurement ) pair has a scale. So handgrip has scale 0, units kg. But icw has scale 1, units kg
pwnz0r has quit [Remote host closed the connection]
<mustmodify>
so we have a config file just to track that.
<mustmodify>
the measurements, their scales, units, optimal ranges, ...
yatish27 has quit [Remote host closed the connection]
<oddmunds>
wouldnt it makes sense to make a Handgrip class?
<oddmunds>
with this stuff in it?
<apeiros_>
mustmodify: def scaled(scale) on Numeric which returns the string output with that precision?
<apeiros_>
though, it'd mean you'd have to call it where you print instead of e.g. setting it from start
yock has joined #ruby-lang
ikrima has quit [Ping timeout: 256 seconds]
<mustmodify>
apeiros_: that's probably what I'll end up doing, though there are some places where I take a scaled number and do math with it, so that'll be interesting.
<mustmodify>
oddmunds: No. On top of the fact that we have 381 current "Noumena" ( kinds of measurements ), an upcoming feature is to support measurements that we haven't cataloged... and just figure out the scale based on the input.
<oddmunds>
mustmodify: then make them objects, not classes?
<oddmunds>
idk
yock has quit [Ping timeout: 245 seconds]
yfeldblum has joined #ruby-lang
<headius>
mustmodify: you should be using BigDecimals then
<headius>
they preserve scale
<headius>
is there a reason you're not?
<mustmodify>
headius: Geez! I thought BigDecimal was frozen along with everything else!
<headius>
does it matter?
<mustmodify>
yes it matters because if it's frozen, you can't set attributes.
<headius>
why do you need to set attributes?
<mustmodify>
like
<headius>
it's a number
<mustmodify>
it's a number with a scale.
<headius>
numbers shouldn't be mutable
<headius>
yes, and every BigDecimal has an immutable scale
<mustmodify>
to physicians, 3.0 != 3.000
arooni-mobile has quit [Read error: Connection timed out]
<headius>
if you want to change the scale you make a new BigDecimal
<mustmodify>
headius: it already has scale? That's awesome.
diegoviola has quit [Quit: WeeChat 1.0.1]
<mustmodify>
headius: Thanks! That pretty much solves my whole problem.
arooni-mobile has joined #ruby-lang
yfeldblum has quit [Ping timeout: 255 seconds]
<headius>
it should...I'm confirming how that's handled
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
arooni-mobile has quit [Max SendQ exceeded]
arooni-mobile has joined #ruby-lang
<mustmodify>
headius: Well, looks like you can do it with BigDecimal.new("3.0014").round(3)
<mustmodify>
which should work.
kiyote23 has quit [Remote host closed the connection]
<headius>
yeah I was hoping it would pick it up from the string
<headius>
oh
<headius>
nevermind, yeah
<headius>
hmmm
<mustmodify>
headius: Since we're storing the values as strings in the database (because many values aren't numeric) it's fine.
<headius>
I'm not seeing the actual BigDecimal objects look differently
<headius>
they both seem to normalize to 0.3E1
<headius>
oh, my case is "3.000" with various rounding widths
<headius>
btw
<mustmodify>
headius: so it looks like BigDecimal doesn't store the scale (or, not that I'm seeing). More importantly, though, it isn't frozen, so I can add that.
<headius>
it should store scale :-( sorry I mislead, the Java BigDecimal we use to implement it *does* preserve scale
<mustmodify>
In fact, I already have BigDecimal extended to do that. I assume there is some place in my app where I'm not using BigDecimals and that just finding that and switching over to BD will solve my issue.
<mustmodify>
headius: damn Ruby. Maybe rubinius'es slogan should be UseJava(tm). <snark />
j4cknewt has quit [Read error: Connection reset by peer]