c0ncealed1 has quit [Remote host closed the connection]
c0ncealed1 has joined #ruby
<nima_m>
hi ,which IDE/editor is best to use for ruby?
<dminuoso>
nima_m: The one you are most comfortable with.
<dminuoso>
nima_m: emacs or vim are great choices. But any editor you like that has syntax highlighting and tags support will work
suukim has quit [Quit: Konversation terminated!]
<mohsen_1>
dminuoso: Are there any IDEs too?
Burgestrand has quit [Quit: Closing time!]
<dminuoso>
mohsen_1: RubyMine and emacs probably give you the most integrated experience
<Zarthus>
i find ruby to work poorly on any IDE, i much prefer text editors
<mohsen_1>
dminuoso: Hm, what would you personally recommend(I don't have experience with vim/emacs)
guille-moe has joined #ruby
<dminuoso>
mohsen_1: Editors are like religions. Try them out and pick one you like.
<dminuoso>
But dont talk about it.
<dminuoso>
mohsen_1: Lack of experience is something you can change. ;)
<dminuoso>
mohsen_1: Personally I use spacemacs with evil mode.
rmerry has joined #ruby
<dminuoso>
The complexity of the editor is not that much of an issue, because you can be productive with very little knowledge. They don't require much experience, but they just offer much power once you learn it.
<rmerry>
hey guys; in Rails 5 is there an easy way to make the json serializer (when serializing a model to json) to not output fields with a nil (null) value?
<dminuoso>
?rails
<ruby[bot]>
Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
<mohsen_1>
dminuoso: You're right
<rmerry>
cheers
jenrzzz has joined #ruby
ellcs has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
amar has joined #ruby
Quentinius has joined #ruby
Burgestrand has joined #ruby
Quentinius has quit [Client Quit]
<Zarthus>
rmerry: fyi APIs that have hidden fields are a pain in the ass to work with :P
<Zarthus>
especially if not documented
amar has quit [Ping timeout: 276 seconds]
jenrzzz has joined #ruby
amar has joined #ruby
<rmerry>
I was under the impression that it's standard practice not to return null fields in json
<Zarthus>
it only really works if your documentation reflects everything :P
<Zarthus>
my day job kind of involves reading poorly documented/written apis and implementing them.
<rmerry>
thank you for the advice Zarthus
_antares_ has joined #ruby
<Zarthus>
especially when it's something like "if this value is set, do this instead of that" -- it'd be so much better if they just used a boolean :P
jenrzzz has quit [Ping timeout: 256 seconds]
ta_ has quit [Remote host closed the connection]
<rmerry>
indeed, I can see it being more convenient for front end devs
<rmerry>
though I guess the downside is you might be returning more data than necessary over the wire
<rmerry>
though in my case that's probably not an issue
<Zarthus>
i'm actually a backend dev
<Zarthus>
i interface with third party apis
<Zarthus>
if it's an internal tool, go wild because they can bug you with questions and you can describe the ticket implementation
tomphp has joined #ruby
saTchymoto has joined #ruby
<dminuoso>
10:35 rmerry | I was under the impression that it's standard practice not to return null fields in json
tomphp has quit [Read error: Connection reset by peer]
<dminuoso>
`null` generally has the same conncation as `NaN`
<dminuoso>
*connotation even
dogweather has joined #ruby
Beams has joined #ruby
ta_ has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jottr has joined #ruby
ta_ has quit [Ping timeout: 276 seconds]
physicist__ has joined #ruby
simmaniac has joined #ruby
yohji has quit [Remote host closed the connection]
roamingdog has joined #ruby
yohji has joined #ruby
sysvalve has quit [Ping timeout: 255 seconds]
dogweather has quit [Read error: Connection timed out]
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
simmaniac is now known as sysvalve
roamingdog has quit [Ping timeout: 240 seconds]
tomphp has joined #ruby
jottr has quit [Ping timeout: 250 seconds]
ur5us has joined #ruby
ellcs has quit [Ping timeout: 276 seconds]
dogweather has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
tvw has quit [Ping timeout: 250 seconds]
tomphp has quit [Read error: Connection reset by peer]
jottr has joined #ruby
tomphp has joined #ruby
tomphp has quit [Client Quit]
robertothais has joined #ruby
tvw has joined #ruby
postmodern has quit [Quit: Leaving]
<apeiros>
dminuoso: IME sql is the only language treating it as such, though. or are there other languages?
kapil___ has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<apeiros>
(and I hate sql for treating null similar to NaN)
<dminuoso>
apeiros: Actually yeah you are right.
Burgestrand has quit [Quit: Closing time!]
Burgestrand has joined #ruby
dogweather has quit [Read error: Connection timed out]
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
dogweather has joined #ruby
ellcs has joined #ruby
camonz has joined #ruby
jenrzzz has joined #ruby
Mike11 has joined #ruby
conta has quit [Read error: Connection reset by peer]
conta has joined #ruby
karapetyan has joined #ruby
amatas has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
amatas has quit [Client Quit]
dogweather has quit [Ping timeout: 260 seconds]
suukim has joined #ruby
ur5us has quit [Remote host closed the connection]
plexigras has joined #ruby
ur5us has joined #ruby
dogweather has joined #ruby
alfiemax has quit [Remote host closed the connection]
dr3w_ has quit [Read error: Connection reset by peer]
jottr has quit [Ping timeout: 240 seconds]
blackmesa has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
dr3w_ has joined #ruby
dogweather has quit [Ping timeout: 240 seconds]
sepp2k has joined #ruby
suukim has quit [Ping timeout: 240 seconds]
dogweather has joined #ruby
RedNifre has joined #ruby
raynold has quit [Quit: Connection closed for inactivity]
ellcs has joined #ruby
n0m4d1c_ has quit [Remote host closed the connection]
amar_ has joined #ruby
KeyJoo has joined #ruby
tomphp has joined #ruby
kurko_ has joined #ruby
Junaos has joined #ruby
n0m4d1c has joined #ruby
dogweather has quit [Ping timeout: 268 seconds]
tomphp has quit [Client Quit]
dogweather has joined #ruby
drale2k_ has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
Beams_ has joined #ruby
Beams has quit [Ping timeout: 260 seconds]
anisha has quit [Quit: This computer has gone to sleep]
jenrzzz has quit [Ping timeout: 255 seconds]
tomphp has joined #ruby
oleo has joined #ruby
dogweather has quit [Remote host closed the connection]
dogweather has joined #ruby
TinkerT has quit [Read error: Connection reset by peer]
TinkerT has joined #ruby
n0m4d1c has quit [Remote host closed the connection]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
RedNifre has quit [Ping timeout: 248 seconds]
fyrril2 has quit [Quit: Leaving]
jenrzzz has joined #ruby
suukim has joined #ruby
Mike11 has joined #ruby
zipace has joined #ruby
vee_ has quit [Ping timeout: 260 seconds]
oleo has left #ruby ["Leaving"]
cyberg has joined #ruby
nowhere_man has joined #ruby
Asher has quit [Ping timeout: 264 seconds]
k0mpa has joined #ruby
<Mike11>
Hello all, I am new to ruby, I created my gem using gem bundle xxx. and now that it is functioning mostly the way I want, I tried to setup travis to build, but I am getting an error:
<Mike11>
0.40s$ bundle exec rake
<Mike11>
Tasks: TOP => default(See full trace by running task with --trace)
<Mike11>
...
<Mike11>
Don't know how to build task 'spec' (see --tasks)
<dminuoso>
For me the mouse is mostly for dragging windows around..
<apeiros>
dminuoso: nah, I like mousing even for stuff like text editing. it's rare, but there's situations where it's definitively faster than any keyboard combo possibly could be.
<Mike11>
apeiros: so should I edit my Rakefile even for a hello-world kind of gem?
<apeiros>
Mike11: I have no idea what you *should* do, since that depends entirely on what you want to happen.
<apeiros>
(and additionally of course on your context, which I know next to nothing about)
<dminuoso>
apeiros: Oh yeah, the mouse is not complete useless. Though the times when I actually touch it are rare on a good day.
_antares_ has quit [Remote host closed the connection]
<dminuoso>
I dont actually recall this, but Im sure there may even have been days that I didn't touch the mouse for hours at a time.
<dminuoso>
(While working on the computer of course!)
jottr has joined #ruby
<apeiros>
dminuoso: yeah, I think I'm ~95% keyboard and 5% mouse.
<apeiros>
maybe 90/10
<apeiros>
and re tiling manager: yes! that'd lower my mouse usage even further. a lot of it is "arranging windows".
<dminuoso>
Yup
jenrzzz has quit [Ping timeout: 268 seconds]
<apeiros>
and with 30" screens there's really little point in overlapping windows.
blackmesa has quit [Ping timeout: 250 seconds]
<apeiros>
spaces + tiling
<Mike11>
apeiros: ok, I get your point. I am writing a gem that should (when installed) be picked up by another gem (which invokes some functions/instantiates objects from classes in my gem)
<dminuoso>
apeiros: I mean I try to avoid terminal madness and just use a single terminal window with fullscreen and tmux inside.
<dminuoso>
"terminal space tiling"
tomphp has joined #ruby
<dminuoso>
So it's one screen tmux (tiled), one screen emacs (tiled), and one screen with a browser window
<apeiros>
hm, I have one terminal window per project with multiple tabs. usually tab 1 = rails s, tab 2 = rails c, tab 3 = git stuff, tab 4 = open for whatever.
<apeiros>
Mike11: ok, what should your CI do?
<Mike11>
apeiros: I am not sure what it should do yet, I am not planning to write tests for this (so maybe just "build" the gem?)
dogweather has joined #ruby
tomphp has quit [Client Quit]
<apeiros>
then configure your CI task to do that. right now it runs `bundle exec rake` which in turn is set to be `bundle exec rake spec`. and that's not about building your gem.
<apeiros>
and I'd say "Could not find .travis.yml, using standard configuration." is related to that.
tomphp has joined #ruby
<Mike11>
apeiros: using rake seems to be the default way for checking gems on travis
<Mike11>
and I thought that I should stick to that since I don't have experience to choose something else
RougeT430 has joined #ruby
<apeiros>
you'll have to make up your mind
<apeiros>
you just said you don't plan to write tests. what travis by default runs *are* tests.
<apeiros>
so either write tests or configure travis to do what you said before (build the gem)
<Mike11>
mm, I get your point, thank you very much and sorry for the noise
samosaphile has joined #ruby
<apeiros>
wasn't noise, you're welcome.
kmurphy4 has joined #ruby
<Mike11>
apeiros: thanks :)
dogweather has quit [Ping timeout: 240 seconds]
tomphp has quit [Client Quit]
RougeR has quit [Ping timeout: 240 seconds]
samosaphile has quit [Client Quit]
KeyJoo has quit [Read error: Connection reset by peer]
<mensvaga>
Anybody have experience with the Syslog module in here?
ramfjord has quit [Ping timeout: 240 seconds]
jcarl43 has joined #ruby
<mensvaga>
For instance, why this: error() - Logs a message at the error (syslog warning) log level
<mensvaga>
fatal() - Logs a message at the fatal (syslog err) log level
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
caleBOT has joined #ruby
caleBOT_ has joined #ruby
<mensvaga>
warn() - Logs a message at the warn (syslog notice) log level,
<mensvaga>
?!
dcunit3d has quit [Ping timeout: 255 seconds]
<mensvaga>
Is there a 'syslog/logger/actualsyslog' ?
cgfbee has joined #ruby
caleBO___ has joined #ruby
caleBOT__ has joined #ruby
tomphp has joined #ruby
caleBOT_ has quit [Ping timeout: 260 seconds]
caleBOT has quit [Ping timeout: 260 seconds]
bmurt has quit [Ping timeout: 264 seconds]
cagomez has joined #ruby
dogweather has joined #ruby
<Zarthus>
you could always alias the methods
<mensvaga>
... I did. But, that felt kind of yucky.
<mensvaga>
I see it has a "add" thing, so I might be able to add "real_syslog_info", etc, and then just wrap those
_antares__ has quit [Quit: Connection closed for inactivity]
<mensvaga>
But, I was wondering if somebody had already done that.
<Zarthus>
it kind of makes sense to me though, there's no way a fatal() should become LOG_EMERG or LOG_CRIT
<Zarthus>
it's a ruby program, not a system-dependent critical software
<mensvaga>
I suppose that's not the correct approach to have when thinking about software. Somewhere, somebody assumes that Ruby is a quality programming language to be relied upon.
<mensvaga>
"Critical", if you will.
<Zarthus>
i mean, from a syslog perspective, the man page describes LOG_CRIT as a critical system issue
<Zarthus>
and LOG_EMERG literally is an emergency, your system is "no longer usable"
dogweather has quit [Ping timeout: 265 seconds]
<mensvaga>
wow, so, no. You're taking the definition of "system" to be to restrictive in this case.
<Zarthus>
maybe, I've only read part of the manpage :)
<mensvaga>
It's not necessarily the "computing system" you're on, it's the "environment / system you're interacting with"
<mensvaga>
Let's just say you're running a door lock system with Ruby
<mensvaga>
and them dinosaurs escape
<mensvaga>
and you're all like "emergency! Dinosaurs escaping"
<mensvaga>
Ruby programmer comes to you and says, "LOL. Ruby not critial. No way for emergency."
mroutis has joined #ruby
<mensvaga>
You'd be all like, "But... but the door lock system is unusable! And it's an emergency!"
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Zarthus>
there's no emergency in that one either, though
<mensvaga>
Closer. But they still unknown => alert
<mensvaga>
Perl doesn't have an emergency one either, but it's easy to add.
tomphp has joined #ruby
<Zarthus>
you could extend and modify LO:GGER_MAP
_antares_ has joined #ruby
<mensvaga>
Yeah. I'd have to remap everything except for debug and info.
<Zarthus>
less hacky than aliasing methods
<mensvaga>
OK. Got the answer I was expecting, but not what I hoped for. I'll remap everything.
<mensvaga>
thanks :)
tomphp has quit [Client Quit]
mikecmpbll has quit [Quit: inabit. zz.]
dogweather has quit [Ping timeout: 264 seconds]
ellcs has joined #ruby
kurko_ has joined #ruby
mroutis has quit [Ping timeout: 246 seconds]
drale2k_ has joined #ruby
RougeT430 has quit [Ping timeout: 250 seconds]
<havenwood>
exit
dogweather has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
_antares_ has quit [Remote host closed the connection]
apparition has quit [Quit: Bye]
dogweather has quit [Ping timeout: 240 seconds]
Asher has joined #ruby
govg has quit [Ping timeout: 246 seconds]
clemens3 has quit [Ping timeout: 256 seconds]
dogweather has joined #ruby
_antares_ has joined #ruby
<mensvaga>
wait, so, somebody took a more accurate syslog module, and then made a less accurate one because "ruby can't be used for system critical stuff" ?
chocoelho has quit [Quit: Konversation terminated!]
dcunit3d has joined #ruby
dogweather has quit [Ping timeout: 256 seconds]
RedNifre has joined #ruby
_antares_ has quit [Remote host closed the connection]
GodFather has joined #ruby
<nolanv>
Much of Ruby was developed by raptors. They have a personal stake in this.
yohji has quit [Remote host closed the connection]
dogweather has joined #ruby
<nolanv>
LOL
<al2o3-cr>
mensvaga: syslog does have critical and emergency
dcunit3d has quit [Read error: Connection reset by peer]
dcunit3d has joined #ruby
<mensvaga>
welcome to the party.
<nolanv>
gracias, amigo
sanscoeur has joined #ruby
cthulchu_ has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
cthulchu has quit [Ping timeout: 240 seconds]
chouhoul_ has joined #ruby
NingaLeaf has joined #ruby
chouhou__ has joined #ruby
chouho___ has joined #ruby
pilne has joined #ruby
chouh____ has joined #ruby
chouhoulis has quit [Ping timeout: 255 seconds]
dcunit3d has quit [Ping timeout: 255 seconds]
Cyrus has quit [Quit: WeeChat 2.1]
chouhoulis has joined #ruby
chouhoul_ has quit [Ping timeout: 255 seconds]
chouhoul_ has joined #ruby
chouhou__ has quit [Ping timeout: 256 seconds]
chouhou__ has joined #ruby
chouho___ has quit [Ping timeout: 264 seconds]
bmurt has joined #ruby
chouho___ has joined #ruby
chouh____ has quit [Ping timeout: 256 seconds]
ellcs has quit [Ping timeout: 246 seconds]
chouh____ has joined #ruby
chouhoulis has quit [Ping timeout: 255 seconds]
chouhoulis has joined #ruby
amar has joined #ruby
chouhoul_ has quit [Ping timeout: 268 seconds]
chouhou__ has quit [Ping timeout: 240 seconds]
chouhoul_ has joined #ruby
guille-moe has quit [Ping timeout: 240 seconds]
chouhou__ has joined #ruby
chouho___ has quit [Ping timeout: 256 seconds]
chouh____ has quit [Ping timeout: 240 seconds]
chouho___ has joined #ruby
mroutis has joined #ruby
chouh____ has joined #ruby
chouhoulis has quit [Ping timeout: 240 seconds]
chouhoul_ has quit [Ping timeout: 240 seconds]
memo1 has quit [Ping timeout: 256 seconds]
chouhoulis has joined #ruby
chouhoul_ has joined #ruby
chouhou__ has quit [Ping timeout: 250 seconds]
chouhou__ has joined #ruby
chouho___ has quit [Ping timeout: 240 seconds]
chouh____ has quit [Ping timeout: 240 seconds]
chouho___ has joined #ruby
Beams_ has quit [Quit: .]
chouh____ has joined #ruby
chouhoulis has quit [Ping timeout: 250 seconds]
chouhoulis has joined #ruby
chouhoul_ has quit [Ping timeout: 240 seconds]
mustmodify_ has joined #ruby
chouhoul_ has joined #ruby
<mustmodify_>
What's the fastest (runtime) way to test for an invalid byte sequence? just =~ /[^\x00..\x7F]/ ?
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhou__ has quit [Ping timeout: 268 seconds]
<mustmodify_>
sorry... non-ASCII characters
gheegh has joined #ruby
chouhou__ has joined #ruby
chouho___ has quit [Ping timeout: 240 seconds]
chouh____ has quit [Ping timeout: 250 seconds]
chouho___ has joined #ruby
n0m4d1c has joined #ruby
Beams has joined #ruby
chouhoulis has quit [Ping timeout: 240 seconds]
chouh____ has joined #ruby
<Zarthus>
maybe .ord > 255
<mustmodify_>
hunh...
chouhoul_ has quit [Ping timeout: 248 seconds]
chouhoulis has joined #ruby
<mustmodify_>
I'll have to test that.
<Zarthus>
a regex might be faster against entire strings, i'm not sure.
<mustmodify_>
I'll benchmark. Good idea, thanks.
d^sh has quit [Ping timeout: 264 seconds]
chouhoul_ has joined #ruby
<Zarthus>
your regex should have a dash rather than two dots anyways (unless ruby does something specific)
ohcibi has quit [Quit: No Ping reply in 180 seconds.]
<mustmodify_>
that's true.
<mustmodify_>
I typed that separately and wrong. Actual code I'm using is /[^\x00-\x7F]/
chouhou__ has quit [Ping timeout: 276 seconds]
RedNifre has quit [Ping timeout: 240 seconds]
<apeiros>
!fixcon chouh____
chouh____ was kicked from #ruby by ruby[bot] [repeated join/part detected]
chouho___ was kicked from #ruby by ruby[bot] [repeated join/part detected]
chouhoulis was kicked from #ruby by ruby[bot] [repeated join/part detected]
chouhoul_ was kicked from #ruby by ruby[bot] [repeated join/part detected]
gregf_ has joined #ruby
<Zarthus>
i'd wonder if testing against truthiness would be faster than falsiness.
<Zarthus>
a-la /^[\x00..\x7F]*$/
<mustmodify_>
shoot... if the encoding is set to UTF8, the regex still blows up with "invalid byte sequence"
chouho___ has quit [Ping timeout: 276 seconds]
ohcibi has joined #ruby
<Zarthus>
does adding the /u flag help?
<apeiros>
Zarthus: wrong anchors
chouh____ has quit [Ping timeout: 248 seconds]
d^sh has joined #ruby
<Zarthus>
apeiros: you want the \A\z ones?
<apeiros>
also wrong range "operator". character classes use "-"
<apeiros>
Zarthus: it's not me who wants that ;-)
shaman42 has quit [Remote host closed the connection]
shaman42 has joined #ruby
<apeiros>
but yes, \A\z would be the correct ones
<Zarthus>
hah, i fell for mustmodify_'s pitfall.
<Zarthus>
what makes them more correct?
<apeiros>
and /u is no longer necessary since 1.9
Beams has quit [Quit: .]
chouhoulis has quit [Ping timeout: 248 seconds]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros>
>> if "I cheat\n\xff" =~ /^[\x00-\x7f]$/ then "broken regex" else "huh? it works correctly?" end
<ruby[bot]>
apeiros: # => invalid byte sequence in UTF-8 (ArgumentError) ...check link for more (https://eval.in/1002951)
<apeiros>
>> if "I cheat\n\xff" =~ /^[\x00-\x7f]$/n then "broken regex" else "huh? it works correctly?" end
<ruby[bot]>
apeiros: # => invalid byte sequence in UTF-8 (ArgumentError) ...check link for more (https://eval.in/1002952)
<apeiros>
watt
<Zarthus>
rip
<apeiros>
>> if "I cheat\nö" =~ /^[\x00-\x7f]$/n then "broken regex" else "huh? it works correctly?" end
<ruby[bot]>
apeiros: # => /tmp/execpad-7411697b833b/source-7411697b833b:2: warning: regexp match /.../n against to UTF-8 strin ...check link for more (https://eval.in/1002953)
<mustmodify_>
looks like there's no way around it.
<apeiros>
ruby, go away, yer drunk
<apeiros>
>> if "I cheat\nö" =~ /^[\x00-\x7f]$/ then "broken regex" else "huh? it works correctly?" end
<mustmodify>
My chat client sometimes gets mixed up and adds an underscore.
<apeiros>
mustmodify: you want true if it contains non-ascii or false?
<apeiros>
mustmodify: just group the underscored nick. /ns help group
<mustmodify>
so that's weird... I'm using 2.1.6 and I get something different.
<apeiros>
you forgot the //n flag.
<Zarthus>
2.1 is no longer supported, though
<apeiros>
also you force encoded to utf-8, that's wrong. force encode to binary.
<mustmodify>
what is //n?
<apeiros>
//n tells ruby that the regex is binary
<Zarthus>
a regex flag (/ is the delimiter)
nitric has joined #ruby
bmurt has quit [Ping timeout: 240 seconds]
<apeiros>
so you compare a binary string with a binary regex. no issues with invalid byte sequences (binary doesn't have such a thing)
<Zarthus>
TIL the ruby catchphrase is "a programmer's best friend"
<apeiros>
but again, you want true if it's ascii-only, or you want true if it contains non-ascii?
quobo has joined #ruby
RedNifre has joined #ruby
<mustmodify>
method is called `valid_encoding?` so I want true if it's all ascii
Puffball has joined #ruby
<apeiros>
that's not what that method does.
<apeiros>
or well, you can get it to. but then you have to force_encoding("ASCII")
<al2o3-cr>
mustmodify: String#ascii_only?
<apeiros>
isn't that after 2.1?
<al2o3-cr>
shouldn't be
<Zarthus>
v1_9
<apeiros>
you're right. that's actually the nicest way then :)
gheegh has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
caleBO___ has quit [Remote host closed the connection]
caleBOT__ has quit [Remote host closed the connection]
<apeiros>
but reading the backlog, I think we're actually solving the wrong problem
caleBOT has joined #ruby
caleBOT_ has joined #ruby
<apeiros>
you have input which you tell ruby is utf-8, but which isn't
<apeiros>
the first question is now whether you have a way to know which encoding your input has - do you?
<mustmodify>
Right. We have an interface. Per the RFC, it should be UTF-8. Sometimes people are dumb, and they tell me it's UTF-8, and then send ISO-8944 or whatever. So I'd like the server to test files. If it finds one that isn't encoded right, to then isolate the file and alert me.
gheegh has quit [Client Quit]
<mustmodify>
Actually I'm not sure it's an RFC, but there's a media type called HL7, which should be ASCII.
<apeiros>
ok. in that case, read the data as binary. input.force_encoding('utf-8').valid_encoding?
<apeiros>
utf-8 has non-ascii bytes.
<mustmodify>
I'd take UTF-8.
<mustmodify>
I mean, it's maybe not preferable, but I just don't want to throw bad encodings into my db.
caleBOT_ has quit [Ping timeout: 240 seconds]
caleBOT has quit [Ping timeout: 240 seconds]
gheegh has joined #ruby
AgentVenom has joined #ruby
<apeiros>
(you may be able to get away with reading it directly as utf-8, but any operation you perform on the input might break if it's not valid utf-8)
<mustmodify>
that's correct.
banisterfiend has joined #ruby
<mustmodify>
that's what happens.
<apeiros>
that's why I'd read it as binary and only tell ruby the encoding is utf-8 in order to test it using valid_encoding?, and that will return false if it's not utf-8.
<apeiros>
I mean, if it's not valid utf-8
amar has quit [Remote host closed the connection]
<mustmodify>
ok, let me run this though rspec and see what happens. :)
jenrzzz has joined #ruby
<apeiros>
if you want to do something with the data after your test told you it's not utf-8, either turn it back to binary via force_encoding('binary'), or do the utf-8+valid_encoding? on a duplicate.
<apeiros>
(note: String#dup is cheap if you don't actually modify the string's data - which you don't, you only change the encoding flag)
amar_ has joined #ruby
alfiemax has quit [Remote host closed the connection]
<mustmodify>
ta da! That works. Thanks all.
alfiemax has joined #ruby
ldepandis has joined #ruby
sanscoeu_ has joined #ruby
amar_ has quit [Read error: No route to host]
caleBOT__ has joined #ruby
caleBOT_ has joined #ruby
suukim has quit [Quit: Konversation terminated!]
RougeT430 has quit [Ping timeout: 264 seconds]
kmurphy4 has quit [Quit: kmurphy4]
sanscoeur has quit [Ping timeout: 264 seconds]
konsolebox has quit [Ping timeout: 256 seconds]
chocoelho has joined #ruby
nowhere_man has quit [Remote host closed the connection]
RougeT430 has joined #ruby
nowhere_man has joined #ruby
alfiemax has quit [Remote host closed the connection]
konsolebox has joined #ruby
darkhanb has joined #ruby
orbyt_ has joined #ruby
alfiemax has joined #ruby
RedNifre has quit [Ping timeout: 264 seconds]
_antares_ has joined #ruby
nowhere_man has quit [Ping timeout: 250 seconds]
RedNifre has joined #ruby
sanscoeu_ has quit [Remote host closed the connection]
NingaLeaf has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sanscoeur has joined #ruby
sanscoeur has quit [Remote host closed the connection]
sanscoeur has joined #ruby
schneider has joined #ruby
caleBOT_ has quit [Remote host closed the connection]
caleBOT__ has quit [Remote host closed the connection]
robertothais has quit [Ping timeout: 255 seconds]
mroutis has quit [Ping timeout: 256 seconds]
alfiemax has quit [Remote host closed the connection]
vee_ has quit [Ping timeout: 248 seconds]
dcunit3d has joined #ruby
Mike11 has quit [Quit: Leaving.]
tfitts has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lytol has joined #ruby
krawchyk has quit [Read error: Connection reset by peer]
za1b1tsu_ has quit [Ping timeout: 256 seconds]
banisterfiend has joined #ruby
banisterfiend has quit [Client Quit]
nolanv has quit [Quit: WeeChat 2.0.1]
sauvin has quit [Remote host closed the connection]
dcunit3d has quit [Ping timeout: 256 seconds]
_antares_ has quit []
cthu| has joined #ruby
vee_ has joined #ruby
cthulchu_ has quit [Ping timeout: 240 seconds]
chocoelho_ has joined #ruby
k0mpa has quit [Ping timeout: 255 seconds]
chocoelho has quit [Ping timeout: 250 seconds]
GodFather has quit [Ping timeout: 256 seconds]
GodFather_ has quit [Ping timeout: 256 seconds]
minimalism has joined #ruby
kurko_ has quit [Remote host closed the connection]
kurko_ has joined #ruby
clemens3_ has joined #ruby
cthulchu_ has joined #ruby
clemens3 has joined #ruby
cthu| has quit [Ping timeout: 240 seconds]
banisterfiend has joined #ruby
agimenez has joined #ruby
caleBOT_ has joined #ruby
caleBOT__ has joined #ruby
RougeT430 has quit [Ping timeout: 240 seconds]
agimenez is now known as sysvalve
anisha has joined #ruby
anisha has quit [Client Quit]
GodFather_ has joined #ruby
GodFather has joined #ruby
simmaniac has quit [Ping timeout: 256 seconds]
ta_ has joined #ruby
cagomez has quit [Remote host closed the connection]
sysvalve has quit [Quit: Leaving]
sameerynho has joined #ruby
ipe has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
clemens3 has quit [Ping timeout: 240 seconds]
dinfuehr has quit [Ping timeout: 240 seconds]
caleBOT__ has quit [Remote host closed the connection]
caleBOT_ has quit [Remote host closed the connection]
dinfuehr has joined #ruby
caleBOT_ has joined #ruby
caleBOT has joined #ruby
nowhere_man has joined #ruby
n0m4d1c_ has joined #ruby
chocoelho_ has quit [Ping timeout: 250 seconds]
ldnunes has quit [Ping timeout: 240 seconds]
n0m4d1c has quit [Ping timeout: 246 seconds]
ldnunes has joined #ruby
eam has joined #ruby
dviola has joined #ruby
blackmesa has joined #ruby
banisterfiend has joined #ruby
Sonar1 has joined #ruby
RougeT430 has joined #ruby
regedit has quit [Quit: Connection closed for inactivity]
bdnelson has quit [Quit: WeeChat 1.9.1]
RougeT430 has quit [Client Quit]
RougeR has joined #ruby
alfiemax has joined #ruby
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has joined #ruby
jrich523 has joined #ruby
ta_ has quit [Remote host closed the connection]
schneider has quit [Ping timeout: 256 seconds]
bmurt has joined #ruby
mroutis has joined #ruby
<jrich523>
rubocop gives me a "useless assignment to variable" which is sort of expected, cuz i dont need it, but is there a way to ignore/dump/discard the output?
schneider has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mustmodify has left #ruby [#ruby]
roamingdog has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dogweather has quit [Remote host closed the connection]
caleBOT has quit [Remote host closed the connection]
caleBOT_ has quit [Remote host closed the connection]
caleBOT has joined #ruby
caleBOT_ has joined #ruby
banisterfiend has joined #ruby
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dcunit3d has joined #ruby
nowhere_man has quit [Remote host closed the connection]
nowhere_man has joined #ruby
bdnelson has joined #ruby
caleBO___ has joined #ruby
caleBOT__ has joined #ruby
mroutis has quit [Ping timeout: 246 seconds]
caleB____ has joined #ruby
cale_____ has joined #ruby
caleBOT_ has quit [Ping timeout: 260 seconds]
caleBOT has quit [Ping timeout: 260 seconds]
NingaLeaf has joined #ruby
cagomez has joined #ruby
NingaLeaf has quit [Client Quit]
postmodern has joined #ruby
caleBO___ has quit [Ping timeout: 260 seconds]
caleBOT__ has quit [Ping timeout: 260 seconds]
dogweather has joined #ruby
claudiuinberlin has joined #ruby
orbyt_ has quit [Read error: Connection reset by peer]
cschnei__ has joined #ruby
xuanrui has joined #ruby
jamiejackson has joined #ruby
cschnei__ has quit [Remote host closed the connection]
robertothais has joined #ruby
cschneid_ has quit [Ping timeout: 256 seconds]
dviola has quit [Quit: WeeChat 2.1]
sanscoeu_ has joined #ruby
dogweather has quit [Ping timeout: 246 seconds]
alfiemax has quit [Ping timeout: 276 seconds]
dogweather has joined #ruby
sanscoeur has quit [Ping timeout: 264 seconds]
xuanrui has quit [Quit: Leaving]
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
dogweather has quit [Ping timeout: 260 seconds]
cschneid_ has joined #ruby
dogweather has joined #ruby
<apeiros>
jrich523: yes, there are special comments with instructions to rubocop. but I'd have to read the docs too.
weaksauce has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mikecmpbll has joined #ruby
cschneid_ has quit [Ping timeout: 256 seconds]
jcalla has quit [Quit: Leaving]
rippa has quit [Read error: Connection reset by peer]
dogweather has quit [Ping timeout: 240 seconds]
karapetyan has joined #ruby
dogweather has joined #ruby
karapetyan has quit [Ping timeout: 264 seconds]
xuanrui has joined #ruby
schleppel has quit [Quit: Konversation terminated!]
cschneid_ has joined #ruby
biberu has quit []
ta_ has joined #ruby
qnaal has joined #ruby
dogweather has quit [Ping timeout: 264 seconds]
agent_white has joined #ruby
sanscoeu_ has quit [Remote host closed the connection]
sanscoeur has joined #ruby
<jrich523>
apeiros you mean use a special comment to ignore the issue?
<jrich523>
i was more so curious if something like this worked
<jrich523>
nil = myMethod(a)
qnaal has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
pb122 has quit [Quit: Leaving]
dogweather has joined #ruby
tomphp has joined #ruby
<apeiros>
jrich523: no
<jrich523>
k, thanks
<apeiros>
left hand side of an assignment must be a variable or a method ending in =
<apeiros>
and nil is not a valid variable name. no keyword is.
weaksauce has joined #ruby
<apeiros>
and re methods ending in =, only with an explicit receiver it's considered as such
n0m4d1c_ has quit [Remote host closed the connection]
<jrich523>
yeah, use to powershell, you'd do either null=whatever, or whatever | null.. but either way, there is a way to dump/ignore the output
<jrich523>
i'll find and toss in the comment to hide the warnings
ipee has joined #ruby
<apeiros>
most tools will ignore unused variables if you prefix them with _
<jrich523>
the guy who wrote this used that for globals, kinda feel like that would send mixed msgs in this case
<apeiros>
glo… bals…?
andikr has quit [Remote host closed the connection]
<apeiros>
that code most likely deserves to be screamed at in that case.
<jrich523>
perhaps lol
<jrich523>
it was tossed at me to "Fix"
<jrich523>
my ruby sucks, figured i'd start with lint...
<apeiros>
delete the code. no code has no errors.
<apeiros>
:-p
<jrich523>
that alone has given me a huge list of updates lol
<apeiros>
I'm being sassy again. ignore me unhelpful comments.
<apeiros>
*my
<apeiros>
rubocop is more than just linting, though
plexigras has quit [Ping timeout: 256 seconds]
ipe has quit [Ping timeout: 265 seconds]
<apeiros>
it also complains about "style violations", and it's not like rubocop's defaults were undisputed
dogweather has quit [Ping timeout: 240 seconds]
<jrich523>
yeah most of what i've google has been disagreement on the rules lol
<apeiros>
a plain lint you can get with just `ruby -c codefile.rb`
<jrich523>
oh cool
<jrich523>
im using vscode, the rabbit hole of extensions sent me to rubocop
<apeiros>
but if you had issues with invalid syntax, you'd get almost certainly immediately a crash.
<apeiros>
oh, I would definitively not use an IDE when starting with ruby.
dogweather has joined #ruby
<jrich523>
yeah this for the most part works well.. most of the problems with it are more so around error handling
<jrich523>
no ide?!
<jrich523>
notepad does support nix line endings now... i can use that! lol
<apeiros>
ok, I did not say I'd use a *crappy* text editor instead.
<jrich523>
lol
<jrich523>
sublime is my other goto
<apeiros>
yeah, sublime is a good choice
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros>
note: it may work just fine to edit a project in an IDE if you started writing it in that IDE. if not, chances are good your IDE will struggle with your setup not being perfectly aligned to the IDEs expectations or some other assumptions it makes.
ryzokuken has quit [Remote host closed the connection]
alfiemax has joined #ruby
ta_ has joined #ruby
GodFather_ has joined #ruby
ciscam has quit [Ping timeout: 256 seconds]
will_ has joined #ruby
ciscam has joined #ruby
emilford has quit [Ping timeout: 240 seconds]
<will_>
from a semi interactive ruby program (just using #gets), I want to foreground another interactive program (postgres's psql). I think exec would work for that, but I'd like for when I quit psql it'd go back to the the ruby program. It seems like something should be possible, like when other pograms use less for a pager, but I'm not sure how to do this. Anyone have pointers on what to look for?
alfiemax has quit [Ping timeout: 260 seconds]
jamesaxl has joined #ruby
orbyt_ has joined #ruby
xuanrui has quit [Read error: Connection reset by peer]
will_ has quit [Remote host closed the connection]
dogweather has quit [Ping timeout: 264 seconds]
caleBOT_ has joined #ruby
caleBOT has joined #ruby
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dogweather has joined #ruby
will_ has joined #ruby
caleBOT_ has quit [Ping timeout: 255 seconds]
caleBOT has quit [Ping timeout: 255 seconds]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
weaksauce has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]