havenwood changed the topic of #ruby to: Ruby 3.2.2, 3.1.4, 3.3.0-preview3: https://www.ruby-lang.org | Rules: https://ruby-community.com | Logs: https://libera.irclog.whitequark.org/ruby
Req has joined #ruby
Req_ has joined #ruby
bambanxx has joined #ruby
bambanxx has quit [Client Quit]
eddof13_ has joined #ruby
eddof13_ has quit [Client Quit]
Req has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
ua_ has quit [Ping timeout: 252 seconds]
eddof13_ has joined #ruby
eddof13_ has quit [Client Quit]
ua_ has joined #ruby
bambanxx has joined #ruby
bambanxx has quit [Client Quit]
m_antis has joined #ruby
m_antis has quit [Client Quit]
m_antis has joined #ruby
m_antis has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
m_antis has joined #ruby
m_antis has quit [Remote host closed the connection]
m_antis has joined #ruby
m_antis has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
reset has quit [Quit: reset]
crespire has joined #ruby
crespire has quit [Remote host closed the connection]
crespire1 has quit [Ping timeout: 260 seconds]
crespire has joined #ruby
caedmon has joined #ruby
fercell has joined #ruby
fercell_ has quit [Ping timeout: 264 seconds]
brokkoli_origin has quit [Ping timeout: 255 seconds]
brokkoli_origin has joined #ruby
TomyWork has quit [Ping timeout: 256 seconds]
jenrzzz_ has quit [Ping timeout: 255 seconds]
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
edr has quit [Quit: Leaving]
jenrzzz_ has joined #ruby
jenrzzz has quit [Ping timeout: 276 seconds]
jenrzzz has joined #ruby
crespire has quit [Ping timeout: 256 seconds]
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 276 seconds]
jenrzzz_ has quit [Ping timeout: 276 seconds]
jenrzzz has joined #ruby
jenrzzz_ has joined #ruby
caedmon has quit [Ping timeout: 260 seconds]
szkl has quit [Quit: Connection closed for inactivity]
jenrzzz has quit [Ping timeout: 246 seconds]
jenrzzz_ has quit [Ping timeout: 264 seconds]
szkl has joined #ruby
jenrzzz has joined #ruby
Vonter has quit [Ping timeout: 268 seconds]
Vonter has joined #ruby
jenrzzz_ has joined #ruby
kaivai has quit [Quit: ZNC - https://znc.in]
kaivai has joined #ruby
jenrzzz_ has quit [Ping timeout: 252 seconds]
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
jenrzzz_ has joined #ruby
_ht has joined #ruby
caedmon has joined #ruby
jenrzzz_ has quit [Ping timeout: 255 seconds]
jenrzzz_ has joined #ruby
caedmon has quit [Ping timeout: 245 seconds]
hwpplayer1 has joined #ruby
gr33n7007h has quit [Ping timeout: 252 seconds]
gr33n7007h has joined #ruby
gr33n7007h has quit [Ping timeout: 256 seconds]
gr33n7007h has joined #ruby
Linux_Kerio has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
eddof13 has quit [Quit: eddof13]
grenierm has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
_ht has quit [Remote host closed the connection]
mange has quit [Ping timeout: 268 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
hwpplayer1 has quit [Quit: I'll be back]
<ox1eef_> leftylink: Why not: c || 1.
<leftylink> actual code is more complex than the concept that the minimal example proves
<leftylink> therefore c || 1 is not an option in for the actual code
jenrzzz_ has quit [Ping timeout: 255 seconds]
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
<ox1eef_> Alright. There's probably a simpler alternative. When Ruby emits parser warnings it's usually a sign to change approach.
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
Paris has joined #ruby
slothby has quit [Quit: brb ... maybe]
<leftylink> yeah true I went with zip instead
Paris has quit [Quit: quit]
jenrzzz_ has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
bougyman has quit [Ping timeout: 240 seconds]
bougyman has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Ping timeout: 246 seconds]
PaulW2U has joined #ruby
jenrzzz_ has joined #ruby
grenierm has quit [Ping timeout: 250 seconds]
jenrzzz_ has quit [Ping timeout: 252 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 252 seconds]
jenrzzz_ has joined #ruby
infinityfye has joined #ruby
Silex has joined #ruby
cimento has quit [Quit: WeeChat 4.1.2]
jenrzzz_ has quit [Ping timeout: 245 seconds]
jenrzzz_ has joined #ruby
Silex has quit [Quit: Client closed]
jenrzzz_ has quit [Ping timeout: 252 seconds]
jenrzzz_ has joined #ruby
PaulW2U has quit [Quit: WeeChat 4.1.2]
jenrzzz has quit [Ping timeout: 245 seconds]
jenrzzz_ has quit [Ping timeout: 255 seconds]
rvalue has quit [Quit: ZNC - https://znc.in]
constxqt_ has quit [Ping timeout: 245 seconds]
TomyWork has joined #ruby
rvalue has joined #ruby
cimento has joined #ruby
jenrzzz has joined #ruby
pvalenta has quit [Remote host closed the connection]
pvalenta has joined #ruby
pvalenta has joined #ruby
pvalenta has quit [Changing host]
<rapha> hmm ... why do people name things like `Types::Scalars::DecimalType`? isn't the purpose of having modules and using them like that so you *don't* have to prefix or suffix everything again, as in `Types::Scalars::Decimal`, in this case? or is this best practice for some reason?
bambanxx has joined #ruby
<rapha> perhaps, since, depending on context, it might just be ::DecimalType or even just DecimalType, it
<rapha> 's simply for better greppability?
constxqt_ has joined #ruby
szkl has quit [Quit: Connection closed for inactivity]
constxqt_ has quit [Ping timeout: 260 seconds]
<ogamita> rapha: both. Perhaps you have DecimalTypes from different modules. Then it's important to qualify it. Perhaps you don't use it enough to justify an import; writing the qualification makes it easier to understand that it's not a local type.
<ogamita> rapha: of course, if you use it a lot, you want a shorter handle. So importing the module and using just the name is indicated.
jenrzzz_ has joined #ruby
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
bambanxx has joined #ruby
Paris has joined #ruby
cimento has quit [Ping timeout: 255 seconds]
constxqt_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 260 seconds]
jenrzzz_ has joined #ruby
Paris has quit [Quit: quit]
jenrzzz_ has quit [Ping timeout: 255 seconds]
<rapha> ogamita: sorry, the way i phrased my question made it easy to misunderstand what i'm actually asking...
<rapha> let me try again
<rapha> if you could easily name something Types::Scalars::Decimal, then why would you name it Types::Scalars::DecimalTyp
<rapha> e
<ox1eef_> One reason could be that you're exporting DecimalType to GraphQL, where namespaces don't exist.
<rapha> interesting. i'm working on a GraphQL API :)
Rovanion has quit [Ping timeout: 268 seconds]
<ox1eef_> You could avoid that - but it is one example where it applies.
<ox1eef_> It could be Types::Scalars::Decimal, and then: graphql_name 'DecimalType'.
<rapha> ox1eef_: so in the specific example of GraphQL, i'd only add the ...Type suffix to anything that ends up in the schema.graphql file. that sounds like sound guidance.
<ox1eef_> Right. Or, call 'graphql_name "DecimalType"' within the definition of the type.
<rapha> but i also love specifying it explicitly. less magic makes for a happier rapha.
<rapha> thank you!!
<ox1eef_> No worries.
fercell has quit [Ping timeout: 256 seconds]
fercell_ has joined #ruby
jenrzzz_ has joined #ruby
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
bambanxx has joined #ruby
jenrzzz_ has quit [Ping timeout: 263 seconds]
jenrzzz_ has joined #ruby
MomosOrDeath4 has joined #ruby
MomosOrDeath has quit [Ping timeout: 276 seconds]
MomosOrDeath4 is now known as MomosOrDeath
jenrzzz_ has quit [Ping timeout: 255 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 260 seconds]
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
jenrzzz_ has joined #ruby
cimento has joined #ruby
<rapha> ox1eef_: hmm, i removed ...Type everywhere now, just to see what the changes to schema.graphql would be, and surprisingly, there are none. apparently, even before, e.g. "ContactType" was being rendered into "type Contact". interesting.
<rapha> might leave it like it is now, because it looks much nicer in Ruby, and still add graphql_name everywhere
<rapha> hmm, otoh, the graphql-ruby docs discourage the use of it ("subject to change")
<rapha> .calc no-rain + not-too-cold + cant-focus-anymore + still-daylight
<rapha> whoops, wrong chan. no such bot.
jenrzzz_ has quit [Ping timeout: 260 seconds]
bambanxx has joined #ruby
jenrzzz_ has joined #ruby
CRISPR has joined #ruby
jenrzzz_ has quit [Ping timeout: 276 seconds]
cimento has quit [Quit: WeeChat 4.1.2]
hwpplayer1 has joined #ruby
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
edr has joined #ruby
bambanxx has joined #ruby
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
bambanxx has joined #ruby
bambanxx has quit [Client Quit]
Rovanion has joined #ruby
<ox1eef_> Interesting indeed :)
bambanxx has joined #ruby
bambanxx has quit [Client Quit]
<rapha> wait ox1eef_, you're not the author of graphql-ruby, are you?
<ox1eef_> Hehe nope. What makes you think that?
<rapha> the smiley art the end of your last sentence :P
<rapha> at*
<rapha> not much to go on, i admit
graywolf has joined #ruby
<ox1eef_> Ah I see. Nah I'm just a user of ruby-graphql like you.
joako has quit [Quit: quit]
eddof13 has joined #ruby
joako has joined #ruby
TomyWork has quit [Remote host closed the connection]
Linux_Kerio has joined #ruby
cimento has joined #ruby
eddof13 has quit [Quit: eddof13]
cimento has quit [Client Quit]
cimento has joined #ruby
cimento has quit [Client Quit]
dviola has quit [Ping timeout: 256 seconds]
eddof13 has joined #ruby
bambanxx has joined #ruby
<rapha> what i'm struggling with is that the way GraphQL works seems to be a little at odds with how CRUD, and indeed OOP are supposed to work
<rapha> so you have "types" to Read and "mutations" to Create/Update/Delete, fine
<rapha> but then you start having class names like ContactSubmitAndCreate and my brain just suffers
<rapha> the gem docs are better, they at least stick to a single verb as part of the class name, and i think i
<rapha> 'll forbid my boss from doing the ...EatAndDrink thing, that just makes it worse.
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
cimento has joined #ruby
eddof13_ has joined #ruby
pandabot has quit [Quit: try to make it work]
pandabot has joined #ruby
Req has joined #ruby
gr33n7007h has quit [Ping timeout: 264 seconds]
Vonter has quit [Quit: WeeChat 4.1.1]
cimento has quit [Quit: WeeChat 4.1.2]
jenrzzz has quit [Ping timeout: 252 seconds]
Paris has joined #ruby
jenrzzz has joined #ruby
<ox1eef_> Right. With GraphQL, typically there is one endpoint, and that is routed through ruby-graphql entities (either queries, or mutations). You don't need much else.
snoojin has joined #ruby
<ox1eef_> Normally I would implement a mutation as a simple object that creates an instance of an action: Actions::CreateContract, etc. I like it. I have plans to create a framework / web toolkit around it.
eddof13_ has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
eddof13 has quit [Quit: eddof13]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
eddof13 has joined #ruby
___nick___ has joined #ruby
eddof13 has quit [Client Quit]
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
<rapha> hmm, that looks much different from what graphql-ruby instructs one to do
<rapha> what you do the same is you also create a class with an imperative name in it, and it doesn't seem to bother you
<rapha> *with its name being a verb in the imperative
szkl has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
Paris has quit [Remote host closed the connection]
bambanxx has joined #ruby
jenrzzz has joined #ruby
gr33n7007h has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
<ox1eef_> True - VerbNoun is common in GraphQL mutations, and that makes sense given that it looks a lot like calling a function in GraphQL. My mutations are usually light, with most of the work forwarded to regular Ruby objects (actions) that follow regular Ruby conventions (eg Actions::Contact::Create).
jenrzzz has joined #ruby
reset has joined #ruby
Munto has quit [Quit: Leaving]
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
CRISPR has quit [Ping timeout: 276 seconds]
eddof13 has joined #ruby
jenrzzz has quit [Ping timeout: 276 seconds]
hwpplayer1 has quit [Remote host closed the connection]
jenrzzz has joined #ruby
vigumnov has quit [Ping timeout: 256 seconds]
Req has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
victori has joined #ruby
bovis has joined #ruby
<bovis> https://bpa.st/A2YQ I'm having trouble processing a text file. My paste shows the structure I've come up with to collect the data.
<bovis> It's a mess later down the line when, for example, I want to change those numbers from strings to ints. I'm nesting loops, and it's difficult to mentally picture it, let alone access the values correctly without a lot of errors in my code.
<bovis> There are hundreds of lines, and many other files I'm hoping to process at once.
jenrzzz has quit [Ping timeout: 252 seconds]
<weaksauce> seems simple enough bovis what have you tried?
<bovis> Separate classes for each file have been helpful for identifying a file/section's individual parts, but the hash where I collect the file lines isn't doing me favors. That seems to be the worst part.
<bovis> At first, I collected everything into an array. I realized all sections for each file were unique, so I changed that to the hash I've shown as an example.
jenrzzz has joined #ruby
<bovis> weaksauce: Now I'm doing things like: file.each {|k,v| v.each |subk, subv| {...}}
<bovis> ^^ this has made it difficult to visualize, and I'd like to edit the content of the file as I go along, and ending up nested like that is leaving me with edits like file[k][0][subk][0] to get to the original hash
<weaksauce> bovis i'd suggest a less functional approach and more of a parsing approach
<weaksauce> build it up as you go
<bovis> weaksauce: Can you be more specific? A quick example?
<weaksauce> build up your subsection separately and add it to your bigger result instead of trying to describe the entire thing at once
<weaksauce> your example data doesn't seem to have much in the way of complexity so i'm not sure
jenrzzz has quit [Ping timeout: 276 seconds]
<bovis> I'll try to break it apart more than I have done
jenrzzz has joined #ruby
<bovis> weaksauce: I know, ahead of time, the names of headers and the titles of lines that follow them. I have considered using structs to organize the data. Like for a section, Fruit, and then two members, Apple and Orange.
<bovis> Can a struct nest a struct? So I have one for file, then a member for file type 1, which references a struct of its own members?
jenrzzz_ has joined #ruby
<bovis> It would be nice to have a name for everything. Is it crazy to collect the structs in its own module, to get it out of the way? The number of lines will long.
<weaksauce> yeah a struct can point to any object so a struct can point to another struct
<weaksauce> what's the 1000 foot view here bovis
<weaksauce> what are you trying to do at the end of the day
<bovis> weaksauce: Collect file content, process lines for validity, sometimes transform content (like "3" to 3), save valid lines to database for later use (like making a graph of how many of an item I have).
<bovis> I care most about the validity of the file and making sure I can put its elements into a table for later use.
<bovis> I want to be able to walk away from this for a month and come back and not be confused about how I structured the project. That's my biggest sticking point right now. I've made something that feels unwieldy (the hash) because it will have so many items and subitems at once, not clearly labeled.
<weaksauce> make meaningful objects if you can
<bovis> weaksauce: Thanks. I know this is very generalized, but it does help.
eddof13 has quit [Quit: eddof13]
eddof13 has joined #ruby
wnd has quit [Remote host closed the connection]
wnd has joined #ruby
<ox1eef_> IME those are lessons you learn next month. Software development is iterative, you can carry some lessons into the next project, but others are still to be learned.
_ht has joined #ruby
___nick___ has quit [Ping timeout: 256 seconds]
sam113102 has joined #ruby
snoojin has quit [Quit: Connection closed for inactivity]
sam113101 has quit [Ping timeout: 276 seconds]
sam113101 has joined #ruby
sam113102 has quit [Ping timeout: 264 seconds]
_ht has quit [Remote host closed the connection]
Paris has joined #ruby
aesthetikx has quit [Ping timeout: 268 seconds]
bambanxx has joined #ruby
eddof13 has quit [Quit: eddof13]
Paris has quit [Quit: quit]
aesthetikx has joined #ruby
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
crespire has joined #ruby
patrick__ has joined #ruby
Munto has joined #ruby
eddof13 has joined #ruby
jenrzzz_ has quit [Ping timeout: 260 seconds]
jenrzzz_ has joined #ruby
bambanxx has joined #ruby
jenrzzz_ has quit [Ping timeout: 255 seconds]
eddof13 has quit [Quit: eddof13]
graywolf has quit [Quit: WeeChat 4.0.4]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
eddof13 has joined #ruby
jenrzzz_ has joined #ruby
Linux_Kerio has quit [Ping timeout: 245 seconds]
infinityfye has quit [Quit: Leaving]
eddof13 has quit [Quit: eddof13]
crespire has quit [Ping timeout: 255 seconds]
eddof13 has joined #ruby
jenrzzz_ has quit [Ping timeout: 264 seconds]
eddof13 has quit [Quit: eddof13]
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
jenrzzz_ has joined #ruby
eddof13 has joined #ruby