jhass[m] changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.2, 3.0.4, 2.7.6: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
protektwar has quit [Remote host closed the connection]
roadie has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
crankharder has joined #ruby
jpn has joined #ruby
crankharder has quit [Ping timeout: 246 seconds]
roadie has quit [Ping timeout: 260 seconds]
roadie has joined #ruby
gr33n7007h has quit [Ping timeout: 246 seconds]
gr33n7007h has joined #ruby
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
roadie has quit [Ping timeout: 250 seconds]
John_Ivan has quit [Ping timeout: 256 seconds]
roadie has joined #ruby
roadie has quit [Read error: Connection reset by peer]
max85 has joined #ruby
max85 has quit [Client Quit]
stackdroid has joined #ruby
stackdroid has quit [Client Quit]
jhass has quit [Ping timeout: 248 seconds]
szkl has quit [Quit: Connection closed for inactivity]
jhass has joined #ruby
comet23 has joined #ruby
<comet23> anyone use vs code?
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
orbyt has joined #ruby
<comet23> what is the > method in a class?
<comet23> i just defined it because my test cases called for it but the course i'm taking never mentioned anything about it
orbyt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rounin has quit [Ping timeout: 240 seconds]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
abws has quit [Ping timeout: 256 seconds]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
q3lont has joined #ruby
roadie has joined #ruby
sphex has quit [*.net *.split]
forvelin has quit [*.net *.split]
adam12 has quit [*.net *.split]
brw has quit [*.net *.split]
dcx has quit [*.net *.split]
adam12 has joined #ruby
forvelin has joined #ruby
sphex has joined #ruby
brw has joined #ruby
dcx has joined #ruby
Furai has quit [*.net *.split]
il has quit [*.net *.split]
coolshaurya has quit [*.net *.split]
H4Z3_ has quit [*.net *.split]
coffeejunk has quit [*.net *.split]
ccooke has quit [*.net *.split]
dza has quit [*.net *.split]
balo has quit [*.net *.split]
tv- has quit [*.net *.split]
EdwardIII has quit [*.net *.split]
EdwardIII has joined #ruby
ccooke has joined #ruby
coffeejunk has joined #ruby
Furai has joined #ruby
il has joined #ruby
balo has joined #ruby
dza has joined #ruby
H4Z3 has joined #ruby
tv- has joined #ruby
coolshaurya has joined #ruby
comet2317 has joined #ruby
<comet2317> i have an undefined method for nil class
<comet2317> undefined method `[]' for nil:NilClass
<comet2317> if @funding > @salries[employee.title]
<comet2317> the thing is @salaries is a hash and in the hash one of the keys is the job title
<comet2317> the value is the corresponding hash value which is the amount that job title has
<comet2317> example "CEO" => 5000
comet23 has quit [Ping timeout: 250 seconds]
<leftylink> well, the only thing [] is being called on in the code shown so far is @salries. so, obviously @salries has to be null.
<leftylink> s/null/nil/ sorry
<comet2317> but when i run byebug @salaries has a value
<leftylink> so even if @salaries is a hash, it wouldn't matter what it is, if @salries is nil
<comet2317> i've never been more confused =/
<comet2317> is there a place where i can upload the entirety of my project to an online repl with the test cases?
teclator has joined #ruby
<comet2317> oh man sorry
<comet2317> i didn't type the word correctly
<comet2317> wow i feel dumb
<comet2317> i wrote @salries instead of @salaries
<comet2317> i thought it would trigger a not defined error or something if my var names are incorrect
<leftylink> I definitely would prefer it if that happened
<leftylink> one small thing I don't like
<leftylink> hmmmmm I don't even think there's something I can addin to make it happen; there isn't an instance_variable_missing like there is for method_missing is there
jpn has quit [Ping timeout: 250 seconds]
<leftylink> hmmmmmmmmmm
<comet2317> =(
<comet2317> have you heard of tabnine?
<comet2317> this extension is amazing like it's sooo good it reads my mind
<comet2317> it's an autocomplete extension powered by ai i have no clue how it works but i'm impressed by it every time
<leftylink> first time hearing of it
tbob has joined #ruby
<comet2317> get it for your editor
<comet2317> there are others powered by ai but i came across this one by complete accident today
<comet2317> i was just looking for more extensions for the rails stack and this was one of the plugins... i'm extremely impressed
jpn has joined #ruby
jpn has quit [Ping timeout: 272 seconds]
___nick___ has joined #ruby
dionysus69 has joined #ruby
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
jpn has joined #ruby
jpn has quit [Read error: Connection reset by peer]
jpn has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_ht has joined #ruby
comet2317 has quit [Quit: Client closed]
q3lont has left #ruby [Leaving]
oxfuxxx has joined #ruby
<oxfuxxx> hey
<oxfuxxx> it's weird that ruby 3 require baseruby to be built...
<oxfuxxx> it should include its own baseruby that builds itself up in first stage then use that for the main compilation. I'm gonna write ruby 4.0, brb.
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX.]
Furai has quit [Quit: WeeChat 3.5]
Furai has joined #ruby
favadi has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
royo25 has joined #ruby
duderonomy has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 272 seconds]
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
coolshaurya has quit [Quit: Reconnecting]
coolshaurya has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 256 seconds]
favadi has joined #ruby
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rounin has joined #ruby
jpn has joined #ruby
favadi has joined #ruby
TCZ has joined #ruby
shiru has joined #ruby
shiru has quit [Client Quit]
shiru has joined #ruby
TCZ is now known as szukam_pracy_zda
szukam_pracy_zda is now known as test1231231
test1231231 has quit [Quit: ...]
shiru has quit [Ping timeout: 272 seconds]
ollysmith has quit [Ping timeout: 246 seconds]
oxfuxxx has joined #ruby
TCZ has joined #ruby
oxfuxxx has quit [Ping timeout: 248 seconds]
oxfuxxx has joined #ruby
oxfuxxx has quit [Ping timeout: 260 seconds]
oxfuxxx has joined #ruby
ollysmith has joined #ruby
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX.]
bit4bit has joined #ruby
oxfuxxx has joined #ruby
ollysmith has quit [Quit: ZNC 1.8.2+deb2+b3 - https://znc.in]
ollysmith has joined #ruby
royo25 has quit [Quit: Bye]
TCZ has quit [Quit: ...]
teclator has quit [Quit: No Ping reply in 180 seconds.]
teclator has joined #ruby
John_Ivan has joined #ruby
roadie has quit [Ping timeout: 250 seconds]
John_Ivan has quit [Read error: Connection reset by peer]
John_Ivan has joined #ruby
John_Ivan has quit [Client Quit]
John_Ivan has joined #ruby
bit4bit has quit [Ping timeout: 256 seconds]
John_Ivan has quit [Read error: Connection reset by peer]
John_Ivan has joined #ruby
gr33n7007h has quit [Quit: WeeChat 3.5]
roadie has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX.]
favadi has quit [Ping timeout: 250 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
abws has joined #ruby
Starfoxxes has quit [Ping timeout: 260 seconds]
orbyt has joined #ruby
roadie has joined #ruby
orbyt has quit [Client Quit]
Starfoxxes has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
roadie has joined #ruby
orbyt has joined #ruby
codedchaos has quit [Ping timeout: 250 seconds]
codedchaos has joined #ruby
jpn has quit [Ping timeout: 276 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 276 seconds]
<John_Ivan> any idea why creating a struct and calling an init() method where I initialize values doesn't actually affect the variables?
<John_Ivan> e.g
<John_Ivan> Employee = Struct.new(:name, :address) do def init() name = [] address = [] end end
jpn has joined #ruby
<John_Ivan> bob = Employee.new()
<John_Ivan> bob.init()
<John_Ivan> Calling bob.name.push() says the object is Nil.
<adam12> John_Ivan: name and address are locals in your example. They only affect the `init` method.
<adam12> John_Ivan: If you provide a receiver of `self`, it will call the setter of the struct. self.name = []; self.address = []
<adam12> name = [] # local assignment inside method block. self.name = [] # calling setter on self
<John_Ivan> oh I see. but how come that's different from classes?
<John_Ivan> they use... @var
<John_Ivan> instead of self.var
<adam12> John_Ivan: You can kind of do both, but they are not equivalent.
<adam12> John_Ivan: The convention in ruby is that attr_accessor (attr_reader, attr_writer) uses a same-name instance variable as the symbol provided as a backer to the data.
<adam12> John_Ivan: so attr_accessor :foobars will use @foobars
<John_Ivan> I see. Thank you, adam12.
<adam12> calling self.foobars = "foo" and @foobars = "foo" is equivalent, at least as it's concerned for setting @foobars to the value. But you can overwrite setters and getters, so it's not equivalent 100%.
<John_Ivan> I'll keep that in mind then.
<adam12> In your struct, you could probably do @name = [] and it would work.
<adam12> In this case, I might suggest just using a new constructor.
<John_Ivan> adam12, I actually did try that and I got an error.
<John_Ivan> actually no.
<adam12> def self.build(name: [], address: []); new(name, address)
<John_Ivan> No error. Just, same as before. object is Nil.
<John_Ivan> oh my
<adam12> Employee.build or Employee.build(name: "Foo"). Or whatever.
abws has quit [Ping timeout: 246 seconds]
orbyt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ox1eef> just my opinion, but writing self.foo = 1 over @foo = 1 is usually a bad sign.
comet23 has joined #ruby
<comet23> what are the best debugging tools for ruby mine?
<comet23> i mean for vs code
<comet23> but i'm willing to switch to ruby mine if it's really that good
orbyt has joined #ruby
some14u has joined #ruby
<adam12> comet23: I'd probably try the new debug gem with vscode-rdbg extension.
<adam12> comet23: Both are still reasonably new, so the experience on RubyMine might be better, but I'd start with those first and see.
<comet23> where would i get this debug gem
<comet23> gem install?
orbyt has quit [Client Quit]
<adam12> comet23: Yeah. Or add it to your Gemfile if you have one.
<comet23> gem install debug?
<weaksauce> yeah debug
<weaksauce> the one with a million downloads
protektwar has quit [Remote host closed the connection]
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
<comet23> thank you
<comet23> it looks very new
some14u has joined #ruby
<weaksauce> it is pretty new but it is being actively developed by core ruby devs
<weaksauce> and is quite fast
il has quit [Quit: tc]
f^ has joined #ruby
f^ is now known as il
comet23 has quit [Ping timeout: 250 seconds]
<ox1eef> vroom vrooom
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
abws has joined #ruby
some14u has quit [Client Quit]
codedchaos has quit [Quit: Leaving]
<leftylink> vroom vroom vroom like a supersonic? (I will post a link in offtopic)
<ox1eef> vroom vroom like a ferrari or mercedes benz
bit4bit has joined #ruby
mixfix41 has quit [Quit: brb]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
sgt_chuckles has joined #ruby
<sgt_chuckles> i have a dilemma where a rspec example i wrote makes rubcop complain about the number of lines, (because of a hash result im trying to verify). I try to move the hash into a `let` clause, but rubocop says i have too many defined. Is there a workaround this?
<ox1eef> rubocop defaults are insane, i suggest something like standardrb which isnt as pedantic.
roadie has quit [Ping timeout: 248 seconds]
<sgt_chuckles> not a project im in charge of unfortunately :(
<ox1eef> i know your pain, i had a similar scenario and following rubocop defaults i found it has relegated certain syntax to the dustbin and put me in a really tight box where i couldnt breath.
r3m has quit [Quit: WeeChat 3.6-dev]
r3m has joined #ruby
roadie has joined #ruby
_ht has quit [Remote host closed the connection]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
___nick___ has quit [Ping timeout: 276 seconds]
roadie has quit [Ping timeout: 250 seconds]
oxfuxxx has joined #ruby
<adam12> The arbitrary line cop is unfortunate.
<adam12> sgt_chuckles: You can disable single rubocop rules in source code. Might be worth exploring that avenue (ie. ask team lead or see if it's been done elsewhere in project)
<adam12> sgt_chuckles: It looks like `# rubocop:disable SomeRule`
<adam12> standardrb is definitely the more saner standard, imho.
roadie has joined #ruby
<ox1eef> it is, it is sad rubocop decided to try be that standard, it is an amazing tool but its defaults are really extremist.
some14u has joined #ruby
<il> lol
<il> extremist defaults
<sgt_chuckles> name is humorously fitting
<adam12> My only complaint about Standard is I'd like to be able to some_obj.(arg). It expects #call and that makes me sad sometimes.
<ox1eef> yeah, same here, i had to disable that
hanzo has joined #ruby
some14u has quit [Client Quit]
some14u has joined #ruby
<sgt_chuckles> why do i get this error now: `W: Lint/MissingCopEnableDirective: Re-enable RSpec/ExampleLength cop with # rubocop:enable after disabling it.`
<sgt_chuckles> ooh, i see. i put it at the end of the line
<sgt_chuckles> *file
<adam12> sgt_chuckles: Right. Wrap the block you're ignoring.
<sgt_chuckles> ok
<sgt_chuckles> thanks
<ox1eef> someone told me it can be a one-liner if you do it like: some_expr # rubocop:disable Foo/Bar
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ox1eef> it should re-enable after that line
some14u has joined #ruby
some14u has quit [Client Quit]
xlymian has joined #ruby
xlymian has quit [Client Quit]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
bit4bit has quit [Ping timeout: 256 seconds]
xlymian has joined #ruby
dionysus70 has joined #ruby
some14u has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
dionysus70 is now known as dionysus69
xlymian has quit [Remote host closed the connection]
<newton> sgt_chuckles, if it's a work linter setup I'd chat about it in work chat to, or your local lint-lord. might inspire relaxing the rules or someone might suggest a better approach
roadie has quit [Ping timeout: 248 seconds]
<newton> aside: I like rubocop. the only real rules I beef with are the default indention rules that I usually alter by default ¯\_(ツ)_/¯
<havenwood> newton: The whitespace padding inside hashes is my qualm.
<havenwood> As far as spaces, Ruby is two-space soft tab — no debtate!
<newton> like {x: :y} vs { x: :y }?
<havenwood> Yup, I prefer the former and the latter is a Rails style Rubocop adopted.
<havenwood> I never see it outside Rails.
<havenwood> I don't want to question if it's a Hash literal or block.
<havenwood> Even for a second.
<havenwood> Just avoidable. Not a big deal, but the only one I tend to override early.
<newton> I prefer the latter but I do that in js, too. but easy enough to change as you say
bit4bit has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roadie has joined #ruby
ur5us has joined #ruby
<ox1eef> if you follow every rubocop rule, it might not as well be ruby anymore but a restricted subset of it.
roadie has quit [Ping timeout: 248 seconds]
dionysus69 has quit [Ping timeout: 248 seconds]
xlymian has joined #ruby
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
deathadder has joined #ruby
<deathadder> Hi, what does @ mean in a class
<deathadder> like def show @article = Article.find(params[:id]) end
<deathadder> isn't @ like this in python
<deathadder> it sets a class member variable?
<ox1eef> @article is an instance variable, it belongs to the instance of your class.
<ox1eef> since this looks like rails, it would also be available to your views, although some frown upon that and suggest passing them as locals instead.
<deathadder> oh
<deathadder> thanks
<deathadder> how do you pass as a local?
<newton> ox1eef, what exactly is it restricting you from using? I've never felt that it's limited me to a subset of anything
roadie has joined #ruby
bit4bit has quit [Ping timeout: 276 seconds]
<ox1eef> deathadder: render :view, locals: {article: @article}
<ox1eef> newton: for one i don't think it likes my preferred syntax for defining a class module, which is without nesting (eg class Foo::Bar::Baz)
<ox1eef> a class or module*
roadie has quit [Ping timeout: 250 seconds]
ssh073 has quit [Quit: The Lounge - https://thelounge.chat]
hanzo has quit [Quit: Connection closed for inactivity]
ssh073 has joined #ruby
roadie has joined #ruby
ssh073 has quit [Client Quit]
sgt_chuckles has quit [Quit: Client closed]
ssh073 has joined #ruby
emcb543 has joined #ruby
emcb54 has quit [Ping timeout: 248 seconds]
emcb543 is now known as emcb54
roadie has quit [Ping timeout: 248 seconds]
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
roadie has joined #ruby
finsternis has joined #ruby
xlymian has quit [Read error: Connection reset by peer]
roadie has quit [Ping timeout: 240 seconds]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
ssh073 has quit [Ping timeout: 240 seconds]
<deathadder> oops, I made a bug in my routes.rb
<deathadder> forgot a slash
roadie has joined #ruby
<newton> ox1eef, I don't think that is limiting you to a subset of anything
<newton> nothing wrong with liking something more relaxed, just puzzled by the sentiment that any of this is bad
roadie has quit [Ping timeout: 260 seconds]
teclator has joined #ruby
<ox1eef> it is limiting in the sense that i can't use that syntax as per rubocop's defaults.
<newton> that you can configure
<ox1eef> that's not the point, its defaults are the issue, they're too strict and limiting, really put you into a box you have to try manaveaur within.
<newton> I think eslint handles this pretty well by not really having any defaults and you tell it what styleguide you want to use
<newton> I'm curious why standardrb isn't just rubocop-standard that you can install and inherit from in a regular rubocop file, but I imagine shipping a gem and cli encourage using it
<ox1eef> standardrb is built on rubocop, but it's not pedantic. linters are a double edged sword, sometimes theyre helpful and when used to the extreme they can make programming a chore you learn to hate.
<ox1eef> it's important to have room to be free to express yourself, not some rigid model of what is right or wrong.
<newton> I think being pedantic is okay in a large-many-hands project
<ox1eef> i don't.
<newton> I'm not looking for every person in a organization of thousands of developers to be expressing themselves in the codebase
<newton> scale matters, I think, at smaller scale probably much less
<ox1eef> that's fine, but we disagree, i'm really against such practices.
<newton> that's fine. I don't want to drag the idea of using something simpler. I think standard serves a need
<ox1eef> standard sits somewhere in the middle, so that's why i like it.
duderonomy has joined #ruby
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<deathadder> what does render :edit, :status :unprocessable_entity mean
<deathadder> what are these colons
<deathadder> I don't get it
<deathadder> I'm just a Python noob
<deathadder> render :edit, status: :unprocessable_entity
<deathadder> I mean
<deathadder> looks like : means it's a Symbol
<deathadder> Whatever a Symbol is.