If you don’t want to use attr_reader, you can assign the instance variable to a variable that doesn’t share the same name as the method
Ryan Sobol
@ryansobol
@/all the Use attr_reader to define trivial reader methods. style violation has been disabled in the upstream. do a git pull upstream master to pull down the fix
Zac Mrowicki
@zmrow
@ryansobol is it preferable to use attr_reader?
Ryan Sobol
@ryansobol
@zmrow for professional rubyists, yes
@zmrow i’ll demonstrate in class
Zac Mrowicki
@zmrow
cool! thanks
David Ker
@snappy316
@ryansobol Rubocop is fine, but rspec is the one that's failing...
@ryansobol 1) OrangeTree#fruit returns the value of @fruit Failure/Error: expect(orange_tree.fruit).to eq(50) NoMethodError: undefined method `fruit' for #<OrangeTree:0x007fab61ace810 @fruit=50>
# ./spec/class7/exercise2_spec.rb:14:in `block (3 levels) in <top (required)>'
Ryan Sobol
@ryansobol
@snappy316 that means their’s a bug in your solution.
David Ker
@snappy316
@ryansobol haha - apparently "friut" is not the same as "fruit" - my bad :)
If you are ever in Los Angeles, go to UCLA and look at the first computer that ever sent a message over the internet. I think the message was sent to a university in the Bay area, maybe Berkley. And the message was one word.
Ryan Sobol
@ryansobol
was it icanhazcheezburger?
Zac Mrowicki
@zmrow
hahaha
NoahNim
@NoahNim
hey anyone gonna be at codefellows today? I m there right now
@/all How do people feel about getting together Monday Nov 3rd for a Foundations 2: Ruby Celebratory drink? Any ideas for location? Happy hours suggestions?
Katie Kim
@kayeon
Also, how early can people meetup? @janefung suggested the Cactus. Looks like happy hour runs from 3 - 6pm there Mondays
NoahNim
@NoahNim
I am down
_
Zac Mrowicki
@zmrow
That sounds fun!
Zac Mrowicki
@zmrow
Found this last night - could be helpful for supplemental learning. It pulls in resources from all over the web to learn Ruby programming and also web dev w/ Ruby on Rails. http://www.theodinproject.com/ruby-programming
Katie Kim
@kayeon
@zmrow there's so much resource... never feels like enough hours in the day... :) thanks!
Zac Mrowicki
@zmrow
@kayeon np. I feel the same way. Information overload. :fire:
Stephanie Beaton
@StephanieBeaton
I am up / down for Foundations 2: Ruby Celebratory drink Monday Nov 3rd!
NoahNim
@NoahNim
@kayeon hey are you gonna be at codefellows today? I am there now
Katie Kim
@kayeon
we're upstairs
NoahNim
@NoahNim
uh
2nd floor?
Stephanie Beaton
@StephanieBeaton
Hello everyone, we are now able to enrole or Ruby III in Jan 2015 on the Code Fellows website.
Foundations of Ruby Web Development (Jan 5, 2015 - Jan 28, 2015. Mon & Wed, 7-9pm) Cost: $1,500. Financing available.
Zac Mrowicki
@zmrow
yay!
Katie Kim
@kayeon
:D
Ryan Sobol
@ryansobol
@/all yep, F3 Ruby is now available to enroll on panel.codefellows.org
Rachel Lanman
@RSR312-206
hi class- if anyone's around, just wondering if there are any tips for Class 8, ex 3 homework? I'm stuck on where to assign the block_param to 'lunch'.
Derek Maffett
@DerekMaffett
Let me take a look at the assignment really quick
Okay, so you're trying to figure out how to define a method which calls a block with a parameter?
Rachel Lanman
@RSR312-206
right, I'm already calling the block in my method, but not sure how to then call the same block, but now with a parameter
Derek Maffett
@DerekMaffett
You're using yield, right?
Rachel Lanman
@RSR312-206
i'm using block.call
Derek Maffett
@DerekMaffett
Oh, okay. I usually use #call on procs, but I guess that works too
Rachel Lanman
@RSR312-206
ah ok
Derek Maffett
@DerekMaffett
No big deal, I just looked it up, and it works the same way
Rachel Lanman
@RSR312-206
i tried yield on some earlier exercises, and I thought rubocop may have taken issue, but I cant remember
Derek Maffett
@DerekMaffett
I don't think rubocop dislikes yield, but I could be wrong. It might also have to do with whether you reference the block being passed in as a parameter or just leave no reference to it in the method definition
Either way, you're calling a block of code to be run.
How would you normally pass a parameter to a block of code being run (you do it all the time with normal methods)?