s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
s2013 has joined #ruby
zdm has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
lineus has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #ruby
Ven`` has quit [Client Quit]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mossplix has quit [Ping timeout: 260 seconds]
s2013 has joined #ruby
jenrzzz has joined #ruby
davidw has joined #ruby
lineus has joined #ruby
sergioro has joined #ruby
Swyper has joined #ruby
DaRock has quit [Ping timeout: 265 seconds]
NODE has quit [Quit: changing servers]
DaRock has joined #ruby
NODE has joined #ruby
lineus has quit [Ping timeout: 240 seconds]
Swyper has quit [Remote host closed the connection]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
lineus has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Swyper has joined #ruby
sgen has joined #ruby
hutch has joined #ruby
Seich has quit [Quit: Gone fishing.]
reyfi9e has joined #ruby
Seich has joined #ruby
GodFather has quit [Ping timeout: 265 seconds]
fercell has joined #ruby
alex`` has quit [Ping timeout: 268 seconds]
mozzarella has quit [Quit: WeeChat 2.4]
davidw has quit [Ping timeout: 268 seconds]
jenrzzz has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
sergioro has quit [Quit: leaving]
evert has quit [Read error: Connection reset by peer]
evert_ has joined #ruby
fercell has quit [Ping timeout: 272 seconds]
fercell has joined #ruby
NODE has quit [Quit: changing servers]
_Tristan_ has quit [Quit: -= A click to real life biatches!!! =-]
Tristan has joined #ruby
mozzarella has joined #ruby
NODE has joined #ruby
Tristan is now known as Guest3521
fphilipe has joined #ruby
wildtrees has quit [Quit: Leaving]
fphilipe has quit [Ping timeout: 268 seconds]
antimatroid has joined #ruby
<antimatroid>
does ruby have an interpreter? when I just run 'ruby' on ubuntu it stops giving a command prompt like it might, but 'puts "hello"' for example does nothing
<mozzarella>
you mean a repl? there's irb by default
<antimatroid>
like with python if you enter 'python' in the command line it comes up with an interpreter you can pass commands in to and get output from
<mozzarella>
yeah you're looking for irb
lucasb has quit [Quit: Connection closed for inactivity]
<antimatroid>
perfect, ta
MrCrackPot has joined #ruby
<havenwood>
antimatroid: Or consider the Pry gem, which is another popular REPL that doesn't ship with Ruby.
<havenwood>
antimatroid: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<havenwood>
antimatroid: You can also run a one-off script with: ruby -e "puts 'example'"
<antimatroid>
cheers
pwnd_nsfw has quit [Ping timeout: 265 seconds]
<antimatroid>
I will make those suggestions to any users I get
<havenwood>
antimatroid: If you're not using gems, startup time is greatly reduced with the --disable=all flag.
<havenwood>
gitter1234: nvm about minitest/capybara... "This gem is no longer maintained as Capybara has added Minitest support upstream, use that instead."
<havenwood>
perfect
<gitter1234>
hmmm
<havenwood>
that was in 2018... and I've used Capybara without the gem since then... I was just living in the past for a sec
<gitter1234>
no idea what is what, ill deal with it once i get there :D ive barely written a controller let alone a test
<havenwood>
gitter1234: those are nice tools. i've had fairly smooth sailing, other than initial configuration being a pain, especially with headless browsers.
<havenwood>
gitter1234: please ask here if you get stuck or want feedback. many ways to test!
<gitter1234>
I just translated my app into `config/locales/` with `en.yml`, `devise.en.yml`, `XX.yml` and `devise.XX.yml`. In application.rb I put `config.i18n.default_locale = :XX`.
<gitter1234>
Now when I try to load my app I get `I18n::InvalidLocaleData in Devise::Registrations#new: can not load translations from devise.en.yml` regarding `t(:sign_up)` -- because `sign_up` is in `en.yml` not `devise.en.yml`.
<gitter1234>
Why isn't Rails looking through `en.yml`, and also, why isn't it choosing `XX` instead of `en` as specified in application.rb?
<adam12>
gitter1234: I normally use Minitest+Capybara but lately I've been using RSpec+Capybara. For Javascript tests I add Cuprite which drives Chrome directly through the websocket.
<adam12>
gitter1234: Since you're on Rails you could probably stick with Minitest since Rails has decent test runner they ship with now.
<gitter1234>
I see, so RSpec is more all over the place whereas Minitest is Rails-specific. Great, can't wait!
<adam12>
gitter1234: Minitest is more of a tool in a toolbox. It ships with enough to do work but you sometimes need a bit more (Mocha for mock/stub, minitest-sprint for runner, minitest-reporter for more test output, minitest-hooks for hooks, etc).
<adam12>
gitter1234: RSpec ships with all that built in; so if you don't need it then maybe it's wasteful? But if you do it's there. So it's about choosing the right tool for the job :) and what makes you happy.
<adam12>
gitter1234: But more importantly is just writing tests :) go get em. I'm out.
<gitter1234>
Seen :)
<gitter1234>
Later man!
<gitter1234>
Doesn't get more happier than this though. App done after months of hard work. Go get em!
<gitter1234>
Or go get her
<gitter1234>
Go git her
<gitter1234>
Gitter :D
* gitter1234
outie
chalkmonster has quit [Quit: WeeChat 2.7]
chalkmonster has joined #ruby
fphilipe has joined #ruby
fphilipe has quit [Ping timeout: 246 seconds]
Swyper has quit [Remote host closed the connection]
BTRE has quit [Remote host closed the connection]
braincrash has quit [Quit: bye bye]
gix- has joined #ruby
gix has quit [Disconnected by services]
braincrash has joined #ruby
groks is now known as xorl
jacksoow has left #ruby ["Saindo.."]
zdm has quit [Ping timeout: 268 seconds]
tricon has quit [Remote host closed the connection]
Azure|dc has joined #ruby
Azure has quit [Ping timeout: 260 seconds]
sergioro has joined #ruby
cd has quit [Quit: cd]
sgen has quit [Ping timeout: 260 seconds]
ttoocs has joined #ruby
tpanarch1st has joined #ruby
donofrio has quit [Remote host closed the connection]
cthulchu_ has quit [Ping timeout: 268 seconds]
cthulchu_ has joined #ruby
gix- has quit [Ping timeout: 240 seconds]
fercell has quit [Quit: WeeChat 2.7]
mossplix has joined #ruby
claw has quit [Ping timeout: 252 seconds]
mossplix has quit [Ping timeout: 265 seconds]
r3m has quit [Quit: WeeChat 2.8-dev]
r3m has joined #ruby
gitter1234 has quit [Quit: Connection closed for inactivity]
s2013 has joined #ruby
mossplix has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BTRE has joined #ruby
juria_roberts has joined #ruby
<juria_roberts>
Whats the difference between dot and square brackets in ruby?
<baweaver>
Depends on the context
<baweaver>
Technically square brackets are a method
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
VoidVextor0 has quit [Ping timeout: 268 seconds]
mossplix has quit [Ping timeout: 268 seconds]
VoidVextor0 has joined #ruby
pandorian has quit [Ping timeout: 265 seconds]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
fercell has joined #ruby
helpa-bot has joined #ruby
helpa has quit [Remote host closed the connection]
suukim has joined #ruby
helpa-bot has quit [Remote host closed the connection]
helpa has joined #ruby
pandakekok9 has joined #ruby
duderonomy has joined #ruby
cthulchu_ has quit [Ping timeout: 260 seconds]
chalkmonster has quit [Quit: WeeChat 2.7]
fphilipe has quit [Ping timeout: 246 seconds]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
darkstardevx has joined #ruby
tricon has joined #ruby
pandakekok9 has quit [Ping timeout: 240 seconds]
tricon has quit [Client Quit]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pandakekok9 has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sliddjur has joined #ruby
TomyWork has joined #ruby
fphilipe has joined #ruby
sliddjur has quit [Remote host closed the connection]
conta has joined #ruby
mossplix has joined #ruby
mossplix has quit [Ping timeout: 272 seconds]
schne1der has joined #ruby
VoidVextor0 has quit [Ping timeout: 260 seconds]
<bukkitgerman>
Hey, how would i go about turning a DateTime into a pretty string relative to the current time - e.g. "2020-01-24T09:33:21+01:00" to "5 minutes ago"?
<KrzaQ>
Is there a method in ruby to compare strings in terms of language collation? I'd like ł to be between l and m in Polish, or ü between u and v in German
pandakekok9 has quit [Remote host closed the connection]
phaul_ has quit [Ping timeout: 272 seconds]
<Cork>
KrzaQ: don't think so, that would require uniconde glyph language lists
<Cork>
if you change encoding to one "local" for the said language it might do what you want donno
phaul_ has joined #ruby
RiPuk has joined #ruby
RiPuk_ has quit [Ping timeout: 268 seconds]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
phaul_ has quit [Ping timeout: 240 seconds]
<havenwood>
KrzaQ: If you happen to be using Rails: I18n.transliterate('ł') #=> "l"
suukim has quit [Quit: Konversation terminated!]
<havenwood>
There are a variety of gems.
Jonopoly has joined #ruby
<Cork>
havenwood: how would that help with sorting?
<havenwood>
Cork: is the task not to separate the letter from its mark?
<havenwood>
Cork: then you can sort it?
mossplix has quit [Ping timeout: 268 seconds]
ropeney has joined #ruby
<Cork>
havenwood: i _think_ he is trying to get string sorting to sort it "the right way", but only guessing
phaul_ has joined #ruby
<havenwood>
Cork: it seems the "right way" is entirely language specific, unless one just means letters with marks go after the corresponding letter.
<Cork>
yup, that is my take on it too
<havenwood>
Cork: Ah, I didn't actually read the question. That helps.
<havenwood>
KrzaQ wants a language-specific solution, so never mind me.
<adam12>
gitter1234: Learning Ruby while learning Rails is probably something a lot of us did way back in the day (I know I did). So provided you do your own due diligence first, before resorting to asking here, everyone is probably fine with it.
<gitter1234>
Gonna PM you the screenshots in a bit, its starting to look real good
<gitter1234>
Cya in a bit
fig-le-deunch has quit [Ping timeout: 265 seconds]
fig-le-deunch has joined #ruby
TorpedoSkyline has quit [Ping timeout: 265 seconds]
mossplix has quit [Ping timeout: 268 seconds]
Exuma has joined #ruby
TorpedoSkyline has joined #ruby
<TorpedoSkyline>
How does something like ActiveRecord dynamically create properties for a child object based off of a table's columns?
<TorpedoSkyline>
I'm doing something similar. I have an object called Person that's inheriting from a SalesforceModel object. I want to be able to call person.name and have that property because the data store has a 'name' property, but I don't want to have to define each property on each object. I want it to be dynamic
<adam12>
TorpedoSkyline: method_missing or delegators.
<TorpedoSkyline>
I thought it might have been method_missing, but I'll look into delegators as well
<TorpedoSkyline>
Is one preferred over the other?
<adam12>
TorpedoSkyline: Prefer delegators if you can. They are a bit more explicit.
sergioro has joined #ruby
<adam12>
TorpedoSkyline: Method missing has it's uses but is sometimes overused. And it adds a bit of indirection.
<adam12>
TorpedoSkyline: If you know ahead of time which methods you want, definitely delegate.
<TorpedoSkyline>
adam12, so I won't necessarily know. The Salesforce data could have any number of properties
<adam12>
TorpedoSkyline: You likely want method missing then.
<TorpedoSkyline>
I used the delegation pattern a decent amount in iOS so if it works the same way I'll probably have to go with method_missing
<TorpedoSkyline>
adam12, thanks so much for pointing me in the right direction!
<adam12>
TorpedoSkyline: Let's back up one second.
<adam12>
TorpedoSkyline: What's role does Person have? Does it just look like class Person < SalesForceModel::Person or something?
<TorpedoSkyline>
adam12: it looks like Person < SalesforceModel
<TorpedoSkyline>
we could also have Animal < SalesforceModel
<adam12>
TorpedoSkyline: Ah. How do you know which model you're talking to?
mossplix has joined #ruby
<adam12>
(on the salesforce side)
pilcrow has quit []
<jhass>
I like to use SimpleDelegator for simple delegators
pilcrow has joined #ruby
<TorpedoSkyline>
So I have a method called object_name that the parent class also has but doesn't have an implementation for that returns a string
<gitter1234>
* on to some other equally helpless fool
<TorpedoSkyline>
that string will be the object name on the SF side. So Person will have a object_name of "Person__c". Salesforce is weird that way
<adam12>
TorpedoSkyline: Ah OK. I think your best bet might still be method_missing, but definitely check out the delegator options.
<jhass>
doesn't AR query the DB on inherited does a bunch of define_method's?
fig-le-deunch has quit [Quit: Konversation terminated!]
<jhass>
*and does
<adam12>
jhass: It probably does now. I don't know if it always did.
<TorpedoSkyline>
oh I didn't know define_methods was a thing. That might be another option
<adam12>
You can define methods on the fly but don't forget Ruby has a method cache per class, and calling define_method will bust that method cache. It can be expensive.
<adam12>
If you do go the method_missing route, don't forget to define respond_to_missing? as well.
<jhass>
yes it's something that you want to happen at application load time, not at application runtime
<TorpedoSkyline>
Ahh. Interesting.
<TorpedoSkyline>
I'll look into them both. Thanks adam12 and jhass.
s2013 has joined #ruby
phaul__ has quit [Ping timeout: 240 seconds]
s2013 has quit [Client Quit]
Swyper has quit [Remote host closed the connection]
duderonomy has joined #ruby
bvdw has quit [Quit: bvdw]
duderonomy has quit [Client Quit]
Swyper has joined #ruby
bvdw has joined #ruby
fercell has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
duderonomy has joined #ruby
lxsameer has quit [Quit: out]
Swyper has quit [Ping timeout: 268 seconds]
gix has joined #ruby
schne1der has quit [Ping timeout: 265 seconds]
phaul__ has joined #ruby
d3bug has joined #ruby
howdoi has joined #ruby
Ven`` has joined #ruby
tpanarch1st has joined #ruby
fercell has quit [Quit: WeeChat 2.7]
phaul__ has quit [Ping timeout: 265 seconds]
phaul__ has joined #ruby
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fercell has joined #ruby
mossplix has quit [Remote host closed the connection]
s2013 has joined #ruby
mossplix has joined #ruby
mossplix has quit [Read error: Connection reset by peer]
mossplix has joined #ruby
clemens3 has quit [Quit: WeeChat 2.1]
akemhp has quit [Quit: Leaving]
TorpedoSkyline has joined #ruby
phaul__ has quit [Ping timeout: 260 seconds]
akemhp has joined #ruby
sagax has quit [Remote host closed the connection]
dinfuehr has quit [Ping timeout: 240 seconds]
dinfuehr has joined #ruby
rippa has joined #ruby
wildtrees has joined #ruby
wallace_mu has joined #ruby
sergioro has quit [Quit: leaving]
dinfuehr has quit [Ping timeout: 240 seconds]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
dinfuehr has joined #ruby
Swyper has joined #ruby
i9zO5AP has joined #ruby
mossplix has quit [Ping timeout: 268 seconds]
zdm has quit [Remote host closed the connection]
Swyper has quit [Remote host closed the connection]
dinfuehr has quit [Ping timeout: 272 seconds]
<TorpedoSkyline>
Hey folks, is there any way I can access instance variables and instance methods from a subclass within a parent's inherited method? Basically something like this https://ghostbin.co/paste/736p2
<TorpedoSkyline>
As of right now, the instance variables return nil
mossplix has joined #ruby
i9zO5AP has quit [Ping timeout: 272 seconds]
cthulchu_ has quit [Read error: Connection reset by peer]
cthulchu_ has joined #ruby
dinfuehr has joined #ruby
ooheitooh has quit [Read error: Connection reset by peer]
<adam12>
TorpedoSkyline: Yes, but your @name in the subclass is a class variable.
<adam12>
TorpedoSkyline: you'd probably want def initialize; @name = "Bill"; end. Or something that sets it in the instance.
<TorpedoSkyline>
I get NoMethodError (undefined method `nickname' for Child:Class)
<adam12>
TorpedoSkyline: You shouldn't need subclass when you call nickname.
dinfuehr has quit [Ping timeout: 240 seconds]
<adam12>
TorpedoSkyline: just "#{nickname} Peterso" should do fine.
dinfuehr has joined #ruby
<adam12>
TorpedoSkyline: When you use define_method, you're creating a closure. It carries internal state of the scope it was defined from, but then it's bound to where it's defined so it has access to state there too.
<adam12>
TorpedoSkyline: I'm not super familiar with the actual internals of that so I might have butchered it slightly.
<TorpedoSkyline>
adam12, thanks! I'm working on it now to see if I can get it to work
<havenwood>
yoshie902a: I like to commit with: git add -p
phaul__ has joined #ruby
<yoshie902a>
what’s -p?
zlogan85 has quit [Read error: Connection reset by peer]
<havenwood>
yoshie902a: --patch
<havenwood>
yoshie902a: "Interactively choose hunks of patch between the index and the work tree and add them to the index. This gives the user a chance to review the difference before adding modified contents to the index."
<havenwood>
yoshie902a: Give it a try!
zlogan85 has joined #ruby
<havenwood>
yoshie902a: It doesn't add anything before your review.
<yoshie902a>
how does that revert the file?
<havenwood>
yoshie902a: Ahh, I think I totally misunderstood your question.
<havenwood>
yoshie902a: Can you just reset that file?
<yoshie902a>
I tried that, did not work. But did find the solution. I had to do git reset file, then git restore file
<yoshie902a>
not sure why
<havenwood>
yoshie902a: reset then checkout?
<yoshie902a>
havenwood: Thank you, I think that would work too
<havenwood>
yoshie902a: np
<yoshie902a>
I think the key was reseting the file first. Why is that needed?