koan_01_3.rb 311 B

1234567891011121314151617181920
  1. # Now the koan is calling a method named 'a' and ensuring that its
  2. # value is equal to the value just passed to the field setter whose
  3. # name is 'a='. Lets make that happen.
  4. class SomeClass
  5. def self.attribute
  6. end
  7. def a?
  8. false
  9. end
  10. def a=(value)
  11. @val = value
  12. end
  13. def a
  14. @val
  15. end
  16. end