tainbox icon indicating copy to clipboard operation
tainbox copied to clipboard

Incorrect 'default' option behavior for getter

Open loadkpi opened this issue 6 years ago • 5 comments

For example:

class Person
  include Tainbox
  attribute :name, default: 'Vasya', writer: false
end
Person.new.name # => nil

It is expected to be 'Vasya'.

loadkpi avatar Apr 16 '18 15:04 loadkpi

How writer: false is supposed to work anyways? I can't see any use case for the current behaviour. @JelF, do you know something about it?

frvade avatar Apr 16 '18 15:04 frvade

never used writer: false and not suggest it

JelF avatar Apr 16 '18 16:04 JelF

Should we just remove writer and reader options? Are there are usecases for ‘reader: false’?

enthrops avatar Apr 16 '18 17:04 enthrops

@enthrops it would break back-compatibility. I wrote some examples in #20

JelF avatar Apr 16 '18 18:04 JelF

#13 would fix problem described here, i think it is a better solution

JelF avatar Apr 16 '18 18:04 JelF