Could you please explain lines 1-11. I\'m having trouble understanding it. Here\
ID: 3917823 • Letter: C
Question
Could you please explain lines 1-11. I'm having trouble understanding it.
Here's the link for it in case you want to tinker with it: https://gitlab.com/phansch/learn_ruby_solutions/blob/master/10_temperature_object/temperature.rb
temperature.rb 517 Bytes ? 1 class Temperature attr_accessor:f, :c def initialize (opts = nil) 4 opts f: nil, c: nil, .merge(opts |I ) @fopts[:f] @copts [:c] 10 12 13 14 15 16 17 18 19 20 21 def in fahrenheit if @c @c 9.0/5.0 32.0 else @f def in_celsius if @f 23 24 25 26 27 28 29 30 31 32 33 def self.from_fahrenheit(fahrenheit) 34 35 36 (@f 32.0)5.0/9. else def self.from_celsius(celsius) Temperature.new(:c->celsius) Temperature.new(:f -fahrenheit) endExplanation / Answer
Solution:
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.