havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.1, 3.0.3, 2.7.5: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
reset has joined #ruby
oxfuxxx has joined #ruby
goepsilongo_ has joined #ruby
goepsilongo has quit [Ping timeout: 240 seconds]
oxfuxxx has quit [Ping timeout: 240 seconds]
ZAJDAN2 has quit [Ping timeout: 240 seconds]
Cena has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
howdoi has joined #ruby
markong has quit [Ping timeout: 272 seconds]
gr33n7007h has quit [Ping timeout: 240 seconds]
gr33n7007h has joined #ruby
donofrio has joined #ruby
TCZ has quit [Quit: Leaving]
Rounin has quit [Ping timeout: 260 seconds]
Cena has joined #ruby
Cena has quit [Client Quit]
donofrio has quit [Ping timeout: 240 seconds]
Cena has joined #ruby
Cena has quit [Client Quit]
Cena has joined #ruby
Cena has quit [Client Quit]
Cena has joined #ruby
Cena has quit [Client Quit]
justAstache has quit [Read error: Connection reset by peer]
justAstache has joined #ruby
Cena has joined #ruby
Cena has quit [Client Quit]
bluedust has joined #ruby
hanzo has joined #ruby
blacked has joined #ruby
<blacked> is ruby dead?
bluedust has quit [Remote host closed the connection]
bluedust has joined #ruby
<newton> it's still in active development and still powers some larger platforms
ur5us has quit [Ping timeout: 240 seconds]
donofrio has joined #ruby
<blacked> newton should i learn nodejs, go or ruby?
Cena has joined #ruby
Cena has quit [Client Quit]
<sam113101> blacked: ruby
<blacked> tell me can i get job after learning ruby :/
<leftylink> either there is some force, entity, or motivation that is driving this "should", in which case a correct answer to this question requires that you tell us about this force, entity, or motivation, or there is none of these things, in which case the question is unanswerable and you should learn all of them.
<blacked> yes i've already learnt django, nodejs, :(
<blacked> and made some projects
<leftylink> a job. all right, that's a good motivation. in this case, it doesn't matter what language you learn. once you learn one language, you can learn whatever other language is needed for the job
RedNifre has quit [Ping timeout: 272 seconds]
<leftylink> but you may very reasonably say "but I can only spend so much time on a particular language and I would like to hit the ground running in my next job"
<leftylink> that is totally fair to say
<leftylink> in that case, one would need to have an idea of what company, to know what language they are using
sagax has quit [Quit: Konversation terminated!]
RedNifre has joined #ruby
donofrio has quit [Ping timeout: 272 seconds]
blacked has quit [Quit: Client closed]
Cena has joined #ruby
Cena has quit [Client Quit]
ur5us has joined #ruby
blacked has joined #ruby
freeworld has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
gr33n7007h has quit [Ping timeout: 250 seconds]
mahlon has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
ur5us has quit [Ping timeout: 245 seconds]
rhe has quit [Ping timeout: 256 seconds]
rhe has joined #ruby
teclator has joined #ruby
mahlon has joined #ruby
<ox1eef> ruby is not dead, and unlike say python and JS - it is not over saturated either. I see a lot of people on twitter see programming as big bucks, and run to the trending languages like JS/Python - where the demand is high but so is the supply. having said that, my advice is to follow the language you love most, and that will usually lead to a job.
<ox1eef> https://weworkremotely.com and search for 'ruby' - that should give you an idea about what's out there.
Cena has joined #ruby
Cena has quit [Client Quit]
ZAJDAN has joined #ruby
Rounin has joined #ruby
blacked has quit [Ping timeout: 256 seconds]
hololeap has quit [Remote host closed the connection]
goldfish has joined #ruby
hololeap has joined #ruby
goldfish has quit [Ping timeout: 240 seconds]
_ht has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
roadie has joined #ruby
aeris has quit [Ping timeout: 240 seconds]
aeris has joined #ruby
royo25 has joined #ruby
taupiqueur has joined #ruby
aeris has quit [Remote host closed the connection]
aeris has joined #ruby
Cena has joined #ruby
Cena has quit [Client Quit]
mange has joined #ruby
ZAJDAN has quit [Ping timeout: 240 seconds]
blacked has joined #ruby
blacked has left #ruby [#ruby]
goepsilongo has joined #ruby
goepsilongo_ has quit [Ping timeout: 240 seconds]
mange has quit [Remote host closed the connection]
roadie has quit [Ping timeout: 268 seconds]
ZAJDAN has joined #ruby
roadie has joined #ruby
markong has joined #ruby
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
shiru has joined #ruby
taupiqueur has quit [Ping timeout: 272 seconds]
Cena has joined #ruby
Cena has quit [Client Quit]
gr33n7007h has joined #ruby
fef has joined #ruby
gproto23 has joined #ruby
Cena has joined #ruby
TCZ has joined #ruby
goepsilongo has quit [Ping timeout: 240 seconds]
goepsilongo has joined #ruby
shiru has quit [Quit: leaving]
<libsys> hello people... I guess here I could find people using sequel
<libsys> About sequel, do you know guys how can I extend the Model.first method?
<libsys> changing it directly results in weird behavior... Model.[] and Model.find doesn't seem to catch my changes
<libsys> no... .find catches it, [] doesnt
<ox1eef> extend it how? what are you trying to do?
gr33n7007h has quit [Ping timeout: 256 seconds]
<libsys> class Product < Sequel::Model; def self.first(*args, &block)
<libsys> I'm trying to mix a dataset with other attributes (not in database), and it behaves weird
<libsys> I guess I'll need to adapt myself to the codebase of sequel first
TCZ has quit [Quit: Leaving]
<ox1eef> have you tried modifying the behavior in your method, then calling super() ?
<libsys> yup, looks like I found my error, if I need help I'll be back
<ox1eef> another option, and probably cleaner, is to implement your own class method not conflicting with Sequel
<adam12> ^ I'd probably do that.
<libsys> You're probably right... my problem is that my `Model.first` implementation doesn't get called when I do Model['id']
<libsys> but it does when I do `Model[id: 'id']`
<libsys> isn't that weird stuff?
<libsys> xd
some14u has joined #ruby
some14u has quit [Client Quit]
<ox1eef> not sure about that part - i plan to use sequel, but still haven't found the time.
<adam12> libsys: It's probably calling with_pk
fef has quit [Quit: Leaving]
<adam12> libsys: What problem are you solving? Maybe there's a better approach.
some14u has joined #ruby
<libsys> I have a model with dynamic data that comes from a database and fixed data that comes from an array
<libsys> I need the model to show as a unity, incluiding data from both sources
gr33n7007h has joined #ruby
<ox1eef> why don't you put the fixed data in the database?
<libsys> convenience... It's easier for me to work with the data in plain code
<ox1eef> it sounds quite diffilcult to do what you want to do, and you could avoid that diffilculity with all the data in the database.
<libsys> it's not really difficult, but I get that sequel is not designed with my use case in mind
<ox1eef> right
<ox1eef> it basically doesn't work.
<adam12> ox1eef: Can you use after_initialize for this?
<libsys> that seems an interesting approach
<ox1eef> conceptually it boggles my mind a bit, what happens when you query the database, how do you query the in-memory data as well?
<libsys> you dont, static data are attr_reader attributes only
<adam12> Alternatively, make a delegator that does the manipulation for you.
<ox1eef> adam12: not sure. i probably would have never got this far because i'd throw the data into the database to avoid these diffilculties.
<adam12> ox1eef: Almost need a sequel-yaml adapter or something.
<adam12> I know PHP has one for Eloquent.
<ox1eef> how does that work?
<libsys> probably https://rom-rb.org would be a much better approach for something like this
<adam12> libsys: Likely, since it doesn't care where data is from really.
tsujp has joined #ruby
some14u has quit [Read error: Connection reset by peer]
<libsys> but learning the whole stuff and dealing with less support made me choose sequel
<adam12> Same reason why I use Sequel on every project. I think ROM would allow better structuring for larger apps but I've been using Sequel so long :P
<ox1eef> adam12: sounds interesting - as i understood this particular case, the source is *both* the database and an in-memory array, even harder i think.
<adam12> ox1eef: Sequel can join across multiple databases. I could maybe see it working. MemoryDB = Sequel.memory_db; class MyMemoryModel < Sequel(MemoryDB[:some_array]); or something.
<ox1eef> nice
<ox1eef> i have a project in mind for Sequel, hopefully i get it off the ground soon.
some14u has joined #ruby
ua__ has quit [Ping timeout: 272 seconds]
some14u has quit [Client Quit]
ua__ has joined #ruby
some14u has joined #ruby
crankharder has joined #ruby
<libsys> noice... after_initialize is exactly what I needed
<libsys> :)
<libsys> it's even better of my approach because it doesn't affect any behavior of Sequel
<libsys> and even works with .all
some14u has quit [Client Quit]
<libsys> s/of/than
<adam12> libsys: cool
<ox1eef> very good
<ox1eef> can you share the code?
<ox1eef> ok i think i kinda get it, you have a product - some of it in the database, and other parts in PRODUCTS ?
<libsys> yup
<ox1eef> cool
<libsys> I'm kind of experimenting with all this too, hehe... I've created an hybrid static/dynamic web framework
<ox1eef> it is actually different to what i originally imagined.
<ox1eef> i thought PRODUCTS was a row in itself, not part of a row existing in the DB.
<ox1eef> an array of rows rather
<ox1eef> that's cool - more rails rivals the better.
gproto23 has quit [Remote host closed the connection]
aeris has quit [Remote host closed the connection]
aeris has joined #ruby
dorian has quit [Remote host closed the connection]
dorian has joined #ruby
<libsys> leanweb.hacktivista.org if you're interested... during the week I'll release version 0.2.. though it's already on the git repo
bluedust_ has joined #ruby
bluedust has quit [Ping timeout: 256 seconds]
FetidToot has quit [Quit: The Lounge - https://thelounge.chat]
FetidToot has joined #ruby
markong has quit [Ping timeout: 256 seconds]
donofrio has joined #ruby
bluedust_ has quit [Remote host closed the connection]
bluedust has joined #ruby
weaksauce has quit [Ping timeout: 240 seconds]
bluedust has quit [Remote host closed the connection]
tsujp has quit [Quit: Client closed]
donofrio has quit [Ping timeout: 272 seconds]
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
bluedust has joined #ruby
justAstache has quit [Ping timeout: 272 seconds]
justAstache has joined #ruby
weaksauce has joined #ruby
bluedust_ has joined #ruby
<mooff> ooh. try IRB.send(:easter_egg) :)
bluedus__ has joined #ruby
dhruvasagar has joined #ruby
bluedust has quit [Read error: Connection reset by peer]
michigan has joined #ruby
bluedust_ has quit [Ping timeout: 256 seconds]
ZAJDAN has quit [Ping timeout: 260 seconds]
<michigan> Hi! Anybody know of ways to make poorly formatted sentences look partially decent?
<michigan> Ie. " , lorem ipsum dolor. sit amet. "
<jhass[m]> What would you expect as outcome?
<michigan> I know of Rails' `squish` which will give me: ", lorem ipsum dolor. sit amet." But Ruby's `capitalize` won't seem to work because of the leading comma, nor will it work to capitalize any subsequent sentences.
<michigan> Ideally "Lorem ipsum dolor. Sit amet."
<jhass[m]> What would ". lorem ipsum dolor , sit amet" give?
<michigan> jhass[m]: Nothing AFAIK
<michigan> irb(main):001:0> test.capitalize
<michigan> => ". lorem ipsum dolor , sit amet"
<jhass[m]> I mean what result would you expect from that example?
Cena has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<michigan> Oh, "Lorem ipsum dolor, sit amet."
royo25 has quit [Quit: Bye]
<jhass[m]> so invent a dot at the end? :D
<michigan> Oh yeah, my bad. That's for another question
bluedus__ has quit [Remote host closed the connection]
<michigan> Which I'm about to ask soon
<jhass[m]> Just trying to gauge what level of magic you're looking for :)
<michigan> But that `squish` method from Rails is amazing though. It removes trailing and leading whitespace, as well as any whitespace in between words!
<jhass[m]> Are your real sentences all English or random languages?
<michigan> I would say both...
<michigan> * as well as any excess whitespace
<jhass[m]> well that part is just .gsub(/\s+/, " ").strip
<nakilon> .squeeze(" ").strip
<jhass[m]> and then you could continue with stuff like .split(/(?<=[.?!]) /).map(&:capitalize).join(" ")
<jhass[m]> +1
<jhass[m]> but you'll probably find more and more cases to handle and eventually probably ones conflicting with these general rules. And then there's stuff like French where "Hey !" instead of "Hey!" is the proper formatting
<michigan> Oh man!
<michigan> Thank you guys so much
<jhass[m]> so I wonder what constraints to put
<michigan> French say "Hey !"?
<michigan> That explains a lot lol
howdoi has joined #ruby
<jhass[m]> Yes. And we Germans call that plenking :D
<michigan> haha
<nakilon> .gsub(/[.?!]\s+\w/, &:upcase)
<michigan> "Planking is an activity consisting of lying in a face down position, sometimes in an unusual or incongruous location. The palms of the hands are typically touching the sides of the body and the toes are typically touching the ground."
<michigan> Ah yeah, cool.
<jhass[m]> a != e :P
<michigan> I've noticed it with former French colonies as well.
<michigan> Always wanted to go like "My man, you gotta stop using the space bar too much." :D
<michigan> * so much
<mooff> :: "^. . . lorem ipsum dolor ,sit amet".gsub(/^[\s\W_]+/, '').gsub(/[\s\W_]+$/, '').gsub(/\s+/, ' ').capitalize
<ruby-eval> => "Lorem ipsum dolor ,sit amet"
<michigan> But then again I don't wanna be an asshole pointing out peoples' mistakes :/
<michigan> mooff: Thank you man!
<ox1eef> depends on the person - some people appreciate that, and in this case it would be more correct than your suggestion - at least to them.
<mooff> :: "🥙 ^. . . lorem ipsum dolor ,sit amet".gsub(/^[\s\W_]+/, '').gsub(/[\s\W_]+$/, '').gsub(/\s+/, ' ').capitalize
<ruby-eval> => "Lorem ipsum dolor ,sit amet"
<nakilon> :: Dir.pwd
<ruby-eval> => "/"
<nakilon> :: `whoami`
<ruby-eval> ERROR: string contains null byte
<ruby-eval> (eval):1:in ``'
<ruby-eval> (eval):1:in `initialize'
<mooff> \W means 'any non-word character'. it would cleave off letters like 'é', too :(
<michigan> :folded_hands:
<michigan> Mind if I ask my other question now that I have your attention?
bluedust has joined #ruby
<mooff> you'll have to trial-and-error and hand hold based on your data
<michigan> Hand holding lol
<michigan> But yeah:
<nakilon> :: File.read(__FILE__).split("\n")[__LINE__-1]
<ruby-eval> ERROR: No such file or directory @ rb_sysopen - (eval)
<ruby-eval> (eval):1:in `read'
<michigan> I have some strings that sometimes end in incomplete sentences, ie: "Hey, glad to have you back. By the way did", "Hello, how are you? I am on the" etc.
<michigan> Is there a way to remove everything after the final dot or question mark?
<nakilon> :: File.read(#{__FILE__}).split("\n")[#{__LINE__}-1]
<ruby-eval> ERROR: (eval):1: syntax error, unexpected end-of-input, expecting ')'
<ruby-eval> ... ^
<ruby-eval> ...__}).split("\n")[#{__LINE__}-1]
<mooff> nakilon: join ##ruby-eval if you want to play :P
<nakilon> ok, sry
Cena has joined #ruby
<mooff> michigan: what if someone doesn't finish their sentences with a dot?
<mooff> :: s = "this is a test. my old friend... a test!"
<ruby-eval> => "this is a test. my old friend... a test!"
<michigan> Guess I never really thought of that.
<mooff> :: s[..s.rindex('.')]
<ruby-eval> => "this is a test. my old friend..."
<michigan> And yeah, as you just pointed out, exclamation marks!
<mooff> :: s[...s.rindex('.')]
<ruby-eval> => "this is a test. my old friend.."
<michigan> Isn't there a gem though that takes care of this stuff for us?
<michigan> Oh no.
<michigan> I reckon it isn't just dots, question- and exclamation marks that marks the end of sentences these days.
<michigan> We also have 3,633 emojis.
<michigan> * that mark
ur5us has joined #ruby
crankharder has quit [Ping timeout: 250 seconds]
<nakilon> you can't perfectly sanitize all the crap; just delete the emojis and stuff, replace with ":-)" or delete the whole sentences
<nakilon> you won't lose much
dhruvasagar has quit [Ping timeout: 256 seconds]
<mooff> gsub(/./, '')
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 245 seconds]
dhruvasagar has joined #ruby
<michigan> hehe :-)
<michigan> I'll have some better examples for you shortly
<michigan> I do remember adam12 mentioning MTurk, but that was for a different matter
<michigan> jhass[m]: I also remember you helping me make that Net-a-porter Live (www.net-a-porter.com) recorder some 10 years ago.
<michigan> That service has since been discountinued. Maybe because people like us can use it as market research :-)
dhruvasagar has quit [Ping timeout: 256 seconds]
szkl has joined #ruby
dhruvasagar has joined #ruby
crankharder has joined #ruby
dhruvasagar has quit [Ping timeout: 240 seconds]
dhruvasagar has joined #ruby
mitt3ns has joined #ruby
mitt3ns has quit [Changing host]
mitt3ns has joined #ruby
dhruvasagar has quit [Ping timeout: 250 seconds]
dhruvasagar has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
dhruvasagar has quit [Ping timeout: 240 seconds]
taupiqueur has joined #ruby
dhruvasagar has joined #ruby
<mooff> :: ["Hey, glad to have you back. By the way did", "Hello, how are you? I am on the", "It's a mystery..."].map { |s| s[..s.rindex(/[\.\?!]/)] }
<ruby-eval> => ["Hey, glad to have you back.", "Hello, how are you?", "It's a mystery..."]
dhruvasagar has quit [Ping timeout: 256 seconds]
dhruvasagar has joined #ruby
bluedust has quit [Remote host closed the connection]
dhruvasagar has quit [Ping timeout: 240 seconds]
dhruvasagar has joined #ruby
crankharder has quit [Quit: leaving]
taupiqueur has quit [Ping timeout: 240 seconds]
dhruvasagar has quit [Ping timeout: 256 seconds]
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 256 seconds]
dhruvasagar has joined #ruby
dhruvasagar has quit [Ping timeout: 240 seconds]
oxfuxxx has joined #ruby
oxfuxxx has quit [Read error: Connection reset by peer]
oxfuxxx has joined #ruby
dhruvasagar has joined #ruby
oxfuxxx has quit [Ping timeout: 256 seconds]
dhruvasagar has quit [Ping timeout: 272 seconds]
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
taupiqueur has joined #ruby
<adam12> michigan: I used that logo!
taupiqueur has quit [Read error: Connection reset by peer]
taupiqueur has joined #ruby
some14u has joined #ruby
some14u has quit [Client Quit]
bluedust has joined #ruby
taupiqueur has quit [Ping timeout: 256 seconds]
bluedust_ has joined #ruby
some14u has joined #ruby
bluedust has quit [Ping timeout: 240 seconds]
taupiqueur has joined #ruby
ruby-eval has quit [Excess Flood]
ruby-eval has joined #ruby
taupiqueur_ has joined #ruby
taupiqueur has quit [Ping timeout: 268 seconds]
gproto23 has joined #ruby
RedNifre has quit [Ping timeout: 272 seconds]
RedNifre has joined #ruby
taupiqueur_ has quit [Ping timeout: 256 seconds]
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
<rapha> evening all
<rapha> if you have something very specialized such as SQLite3::ResultSet::HashWithTypesAndFields , is there a way to get back to the more basic thing from there, such as Hash ?
<adam12> rapha: Generally you'd call #to_h, no?
<rapha> yeah ... that didn't work
<rapha> oh, wait, if i call #delete first, and then do my #maps instead of the other way around, it ends up as a Hash, and .to_yaml behaves again
<rapha> hmm. funny.
<adam12> rapha: Well, to_h is obviously object dependent.
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12> rapha: It looks like that object inherits from Hash. What about calling #to_hash instead?
<adam12> Oh, maybe you solved it? I dunno.
<ox1eef> another option: Hash.try_convert(obj) - returns nil if the object can't be coerced into a Hash.
dhruvasagar has joined #ruby
ZAJDAN has joined #ruby
dhruvasagar has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
<mooff> the RubyDoc for it shows it is a Hash, with a special #[] method, plus #fields and #types
<mooff> it depends on what the thing is when you want what you want
_ht has quit [Remote host closed the connection]
donofrio has joined #ruby
<mooff> #fields is an array of the field names
<mooff> #[] is def [] key
<mooff> key = fields[key] if key.is_a? Numeric
<mooff> end
<mooff> super key
<mooff> so the class exists to convert [0] into [:field_name], [1] into [:field_name_two] etc
<mooff> otherwise it simply is the basic Hash you want for your other purpose :)
<mooff> if you really need to convert it..
<mooff> :: class MyHash < Hash; def [](*) "useless" end; end; h = MyHash.new; h['test'] = 'useful'
<ruby-eval> => "useful"
<mooff> :: h['test']
<ruby-eval> => "useless"
<mooff> :: h.to_hash.class
<ruby-eval> => MyHash
<mooff> :: h.to_h.class
<ruby-eval> => Hash
<mooff> :: h.to_h['test']
<ruby-eval> => "useful"
<mooff> to_h ought to work on the HashWithTypesAndFields. it's equivalent to MyHash
Cena has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<rapha> adam12: yeah, that was me solving it by not solving it but finding out what triggers it and then not doing it, like i always end up doing, lol
hanzo has quit [Quit: Connection closed for inactivity]
TCZ has joined #ruby
donofrio has quit [Ping timeout: 240 seconds]
va5c0 has joined #ruby
bluedust_ has quit [Remote host closed the connection]
bluedust has joined #ruby
<adam12> rapha: lol
<adam12> yay computers!
bluedust has quit [Ping timeout: 272 seconds]
Cena has joined #ruby
gproto23_ has joined #ruby
michigan has quit [Quit: Connection closed for inactivity]
gproto23 has quit [Ping timeout: 240 seconds]
gproto23_ has quit [Remote host closed the connection]
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ruby
va5c0 has quit [Ping timeout: 272 seconds]
va5c0 has joined #ruby
TCZ has quit [Quit: Leaving]
Cena has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
va5c0 has quit [Ping timeout: 252 seconds]
basso has quit [Quit: The Lounge - https://thelounge.chat]
basso has joined #ruby
cognemo_ has quit [Ping timeout: 240 seconds]
basso has quit [Quit: The Lounge - https://thelounge.chat]
basso has joined #ruby
cognemo has joined #ruby
Cena has joined #ruby
cognemo has quit [Ping timeout: 272 seconds]
cognemo has joined #ruby
Cena has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has quit [Ping timeout: 260 seconds]
mooff has quit [Remote host closed the connection]
mooff has joined #ruby
freeworld has quit [Ping timeout: 240 seconds]