<apotheon>
note to self: consider adding this channel to autojoins
oxfuxxx has quit [Ping timeout: 256 seconds]
oxfuxxx has joined #ruby
freeworld has quit [Ping timeout: 272 seconds]
<apotheon>
note handled
michigan has quit []
oxfuxxx has quit [Ping timeout: 245 seconds]
oxfuxxx has joined #ruby
roadie has joined #ruby
markong has quit [Ping timeout: 272 seconds]
michigan has joined #ruby
liqu1d has joined #ruby
va5c0 has quit [Ping timeout: 272 seconds]
ur5us has joined #ruby
liqu1d has quit [Quit: liqu1d]
<ox1eef>
most the time, i see Rails used as a monolith - but that's not because it doesn't lend itself to being modular. it does.
goldfish has quit [Quit: Leaving]
Sheilong has quit []
ur5us has quit [Ping timeout: 240 seconds]
roadie has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
mooff has quit [Quit: Quit]
mooff has joined #ruby
bluedust has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
va5c0 has joined #ruby
bluedust has quit [Ping timeout: 256 seconds]
oxfuxxx has quit [Ping timeout: 272 seconds]
va5c0 has quit [Ping timeout: 256 seconds]
oxfuxxx has joined #ruby
weaksauce has quit [Remote host closed the connection]
bluedust has joined #ruby
bluedust has quit [Remote host closed the connection]
<michigan>
ox1eef: Reading up on modular monoliths as we speak...
<michigan>
apotheon: Welcome back lol
<ox1eef>
my approach would be to use something like sinatra or roda to mount other rack apps (eg rails, etc).
<michigan>
ox1eef: I'll keep you guys posted đź‘Ť
<michigan>
By the way, I'm trying to check if a JSON response contains `en` or `fr`, but struggle to convert it to a hash (TypeError: no implicit conversion of Hash into String). Can anybody tell what's wrong? https://gist.github.com/basicfeatures/77612d12ed0c4ba5b3e9619dadb4aa5f
Rounin has quit [Ping timeout: 272 seconds]
John_Ivan has quit [Read error: Connection reset by peer]
<ox1eef>
michigan: it looks like you already have a Hash from detect_language.
<ox1eef>
new_hash = json_response["languages"] should work.
<michigan>
Oh I see, my bad. Great, thanks!
<ox1eef>
welcome
<michigan>
Would you happen to know how I could check if that hash has a key present? I tried `if new_hash.key?("en")` but got `NoMethodError: undefined method `key?' for [{"en"=>0.9999953354389854}]:Array`
<ox1eef>
michigan: what response are you expecting? it is kind of odd to have an array of languages, with each element being a hash. why is there not one hash with each language as a key?
<ox1eef>
if that's simply the data you're working with, then languages = json_response['languages']; languages.each { |language, float| if language == "en; ...; elsif language == "de"; ....; end }
<michigan>
It's the response I get from this language analysis API: `{"languages"=>[{"en"=>0.9999970265109813}]}` means there's a 99% probability a sentence is in English. I'm trying to check if the key `en` is present that's all.
<michigan>
Nice! Cheers mate!
<ox1eef>
languages = json_response['languages']; languages.any? { |language| language.key?("en") } }
<ox1eef>
sorry first paste didnt work, the above should work.
<michigan>
Much obliged ❤️
<ox1eef>
if you want to find the response for "en": languages = json_response['languages']; english = languages.find { |language| language.key?("en") }
<michigan>
Great, might come in handy some day
<ox1eef>
yeah, probably require some edits, but hopefully you get the idea
<michigan>
Yep!
<ox1eef>
the structure of the response makes it more awkward than it seems it should be. a single hash rather than arrays wrapping one would be easier to work with,
<michigan>
I'm not fully familiar with the API yet, but I do believe there are cases where it's not sure, so it'll suggest several different languages with their respective probability scores...
bluedust has quit [Remote host closed the connection]
infinity_fye has joined #ruby
infinityfye_ has joined #ruby
infinityfye has quit [Ping timeout: 256 seconds]
infinity_fye has quit [Ping timeout: 256 seconds]
RedNifre has joined #ruby
<RedNifre>
Any known problems regarding ffi on Apple M1? I get funny control frame errors with the YNAB gem: c:0022 p:---- s:0151 e:000150 CFUNC :attach
<RedNifre>
c:0021 p:0258 s:0145 e:000144 METHOD /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275 y
<RedNifre>
"You may have encountered a bug in the Ruby interpreter or extension libraries. "
<RedNifre>
Is that likely? Maybe I should ask the gem maintainer first...
perrierjouet has joined #ruby
analogsalad has quit [Quit: bye]
<nakilon>
RedNifre what is dependent on ffi in your Gemfile.lock? maybe it's misused somehow
graywolf has joined #ruby
hololeap has quit [Ping timeout: 240 seconds]
aeris has quit [Ping timeout: 240 seconds]
infinityfye_ has quit [Quit: Leaving]
aeris has joined #ruby
hololeap has joined #ruby
bluedust has joined #ruby
bluedust has quit [Remote host closed the connection]
bluedust has joined #ruby
bluedust has quit [Ping timeout: 260 seconds]
<havenwood>
RedNifre: Use Rubies that came out after M1.
<RedNifre>
What's the proper way to use ruby on macs anyway? I just switched to macs and heard that the one that comes with the system is old.
reset has joined #ruby
<havenwood>
RedNifre: You can `brew install ruby` for an up-to-date version but most folk working on more than one app use a version switcher like chruby, rbenv, RVM, or asdf so they can have whatever versions of Ruby the app needs.
<havenwood>
RedNifre: Any of those switchers is fine.
michigan has quit [Quit: Connection closed for inactivity]
bluedust has joined #ruby
taupiqueur has quit [Ping timeout: 256 seconds]
bluedust has quit [Remote host closed the connection]
oxfuxxx has joined #ruby
gproto23 has joined #ruby
markong has quit [Ping timeout: 240 seconds]
taupiqueur has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.4]
donofrio has joined #ruby
graywolf has quit [Quit: WeeChat 3.3]
va5c0 has joined #ruby
donofrio has quit [Ping timeout: 272 seconds]
va5c0 has quit [Ping timeout: 272 seconds]
Dooky has joined #ruby
entropie has quit [Quit: ""]
entropie has joined #ruby
Spitfire has joined #ruby
entropie has quit [Quit: ""]
entropie has joined #ruby
Spitfire has quit [Changing host]
Spitfire has joined #ruby
random-jellyfish has joined #ruby
weaksauce has joined #ruby
oxfuxxx has quit [Ping timeout: 240 seconds]
random-jellyfish has quit [Ping timeout: 256 seconds]
perrierjouet has joined #ruby
taupiqueur has quit [Ping timeout: 240 seconds]
taupiqueur has joined #ruby
brown121407 has quit [Ping timeout: 250 seconds]
hwrd has quit [Ping timeout: 250 seconds]
taupiqueur has quit [Client Quit]
brown121407 has joined #ruby
hwrd has joined #ruby
ur5us has joined #ruby
srushe has quit [Ping timeout: 250 seconds]
srushe has joined #ruby
matta has quit [Ping timeout: 250 seconds]
matta has joined #ruby
szkl has joined #ruby
___nick___ has quit [Ping timeout: 256 seconds]
Spitfire is now known as Spitteh
Spitteh is now known as Spitfire
<nakilon>
no, the Gemfile thing does not seem to work
<nakilon>
oh, or maybe it resolves everything and I'm supposed to chose only when installing or running
_ht has quit [Remote host closed the connection]
Dooky has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Dooky has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.4]
gproto23 has quit [Remote host closed the connection]
perrierjouet has joined #ruby
random-jellyfish has joined #ruby
markong has joined #ruby
donofrio has joined #ruby
donofrio has quit [Ping timeout: 240 seconds]
donofrio has joined #ruby
va5c0 has joined #ruby
va5c0 has quit [Ping timeout: 272 seconds]
hololeap has quit [Remote host closed the connection]
hololeap has joined #ruby
donofrio has quit [Ping timeout: 272 seconds]
va5c0 has joined #ruby
pgib has quit [Ping timeout: 252 seconds]
Dooky has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]