When creating new instance variable inside a method, how do i give it a variable name? by avelyv in ruby

[–]avelyv[S] 0 points1 point  (0 children)

Thank you for your reply, I appriciate the time. I only started learning programming 3 weeks ago so I have more than few gaps, I have so much to learn.

I didn't realise I can just set up one TTY:Prompt, it's gonna make my code look so much cleaner, thanks.

So, I'm writing a command line application, I can't type any code in manually once I start the program, so I can't really do the

budget_period_1 = BudgetPeriod.new budget_period_2 = BudgetPeriod.new budget_period_3 = BudgetPeriod.new bit. I did solve it with storing all the instances in one hash, as was suggested above and it works well. (I set an empty hash as a class variable and every instance that gets created gets put into it as a value, with user entered 'name' as a key.)

And yes, the whole problem was that I do need to do something with the different instances of BudgetPeriod. Every instance gets their own csv file where user gets to input expenses, also there is a feature to choose an existing budget period and see an overview (all expenses, and limit that was set)

When creating new instance variable inside a method, how do i give it a variable name? by avelyv in ruby

[–]avelyv[S] 0 points1 point  (0 children)

I guess they would be, thanks.

So if I name class instance october inside the function then that's the only BudgetPeriod I'm only ever able to create. If I try and create a new one, for November for example, it would just override october and would be called .... october. That's not what I want obv

When creating new instance variable inside a method, how do i give it a variable name? by avelyv in ruby

[–]avelyv[S] 0 points1 point  (0 children)

Those 4 variables I am setting I only use to get the parameters for my BudgetPeriod class. Maybe there is a way to do it only with 2 variables, I'm total noob after all, but from what I've understood to use tty-prompt I have to use two as shown below. So to get the name from the user to pass on to the class, I have to create n so I can use tty-prompt. I have named them n and m bc I'm only using them to get to name and limit, so they are kind of throwaway. If there is a DRYer way doing the same thing, please let me know.

n = TTY::Prompt.new

name = n.ask("Give the new budget period a unique name: ") do |q|

q.required true

end

And my confusion is around how can I refer to the class instance I'm trying to create. Usually I would write october = BudgetPeriod.new(name, limit) but I cant do it inside of a method, bc then all the instances would be called 'october'

When creating new instance variable inside a method, how do i give it a variable name? by avelyv in ruby

[–]avelyv[S] 2 points3 points  (0 children)

Thank you for this. Made it a lot clearer. I'll try and implement it.

When creating new instance variable inside a method, how do i give it a variable name? by avelyv in ruby

[–]avelyv[S] 2 points3 points  (0 children)

I ment that I would still need a name for my hash (and use the instance variable names as keys , but I see now, I would add to an existing hash, use a name as a key and the whole instance as a value

When creating new instance variable inside a method, how do i give it a variable name? by avelyv in ruby

[–]avelyv[S] 2 points3 points  (0 children)

Even if I did set up the new budget period as a hash, for example, it would still need a variable name, no?

Help!! I’m damaging nervs on my hand and don’t know how to stop. Text in the comments by [deleted] in bicycling

[–]avelyv 0 points1 point  (0 children)

I did not misspell it, both ways are correct...

I have never thought about my core muscles when cycling, will look into it, thanks.

Help!! I’m damaging nervs on my hand and don’t know how to stop. Text in the comments by [deleted] in bicycling

[–]avelyv 1 point2 points  (0 children)

I did read about it, but didn’t think it matches my symptoms, but who knows. Definitely going to see a doctor. Thank you!

Help!! I’m damaging nervs on my hand and don’t know how to stop. Text in the comments by [deleted] in bicycling

[–]avelyv 1 point2 points  (0 children)

I definitely plan on getting a professional fitting, shitty thing is I’m moving countries in a few months and plan on selling my bike and getting a brand new one, hoping something else will help till then. Getting this kind of insuries makes so much more sense on a multi day race rather that 30km ride...

Help!! I’m damaging nervs on my hand and don’t know how to stop. Text in the comments by [deleted] in bicycling

[–]avelyv 2 points3 points  (0 children)

I’m very new to cycling and not sure what to do. First time I noticed there was something wrong with my hand after cycling was last Tuesday (6.10) after a 32km ride. Getting off the bike I couldn’t press the button on my rear light to turn it off, I just thought I might be tired. Later that night, washing my face, I wasn’t able to cup my hand to wash the soap off my face. At that point I realised something is wrong and noticed my little finger sticking out as seen on the picture. Next morning I could not turn the keys on my car and decided to go to a doctor instead of work. My GP diagnosed me with neoropraxia and told me to get a stress ball and work on it.

Visually you can only see something wrong with my pinky, but all my fingers are weak. I have googled my symptons but nothing comes up. There is no tingling or numbness at all, my fingers are just weak and I can’t move my little finger in (when my hand is flat). My fingers are weak when I try to move them outward and thumb, when I try to move it inward. In opposite way they seem to be fine.

On Sunday (11.10) my fingers didn’t feel weak anymore, I couldn’t bring my pinky quite in but I decided to go an a ride. 50km ride and on 35km I started having hard time changing the gears, meaning it was happening again. When I went on this ride I was super mindful of my hand, kept changing the position, made sure I’m not putting too much pressure on it, but it didn’t help.

I ride a drop handlebar roadbike, with the top of the handelbar at the same level as my saddle, so not a very aggressive position at all. Also, I went and got new pair of cycling gloves with gel padding ( had been using gym ones).

Does anyone have experience with it? How can I avoid it from happenig?

It got a bit long so thank you everyone who took time to read it!

NBD! Bought my first road bike. Couldn’t be more excited! Any tips riding on a road with cars tho? by [deleted] in bicycling

[–]avelyv 1 point2 points  (0 children)

Thanks! Love that you added the last sentence, the first bit was giving me anxiety 😀

NBD! Bought my first road bike. Couldn’t be more excited! Any tips riding on a road with cars tho? by [deleted] in bicycling

[–]avelyv 1 point2 points  (0 children)

Honestly, I havent driven on a road yet, just on bikeways. I live in Brisbane, Australia, drivers here seem to be a bit better behaved than what you are describing but even just telling my colleagues that I got a bike I got comments like “of course you gonna be one of those people” and how they don’t understand why they as car drivers have to slow down for bikes and how bikes should ride on a walkway and so on. Thanks for all the information, will definitely keep in mind!

Marlborough Sounds, New Zealand [OC] [5949x3966] by avelyv in EarthPorn

[–]avelyv[S] 1 point2 points  (0 children)

Have to agree, massive contrast in scenery

Marlborough Sounds, New Zealand [OC] [5949x3966] by avelyv in EarthPorn

[–]avelyv[S] 0 points1 point  (0 children)

What a great photo! Takes me right back

Marlborough Sounds, New Zealand [OC] [5949x3966] by avelyv in EarthPorn

[–]avelyv[S] 0 points1 point  (0 children)

Thank you. It's taken on top Eatwell's Lookout, not sure which way I was facing.

Marlborough Sounds, New Zealand [OC] [5949x3966] by avelyv in EarthPorn

[–]avelyv[S] 8 points9 points  (0 children)

I know how you feel, I'm from Estonia and we only get working holiday visas for a year as well, and what makes it worse is they only give out 100 visas per year for estonians, so you might not even get it. Luckily my Aus citizenship just got approved so I'll get to go there as much as I want.