[#97678] [Ruby master Feature#16752] :private param for const_set — bughitgithub@...
Issue #16752 has been reported by bughit (bug hit).
5 messages
2020/04/02
[ruby-core:98064] [CommonRuby Feature#16817] attr_predicate or attr_query or attr_something for ? methods
From:
robot@...
Date:
2020-04-25 14:27:37 UTC
List:
ruby-core #98064
Issue #16817 has been reported by robotdana (Dana Sherson). ---------------------------------------- Feature #16817: attr_predicate or attr_query or attr_something for ? methods https://bugs.ruby-lang.org/issues/16817 * Author: robotdana (Dana Sherson) * Status: Open * Priority: Normal ---------------------------------------- I would like `attr_predicate` like attr_reader etc. `attr_predicate :cat` would define a method named `:cat?` that returned the value for ivar `@cat`. I would like this because i find myself writing this: ``` def cat? @cat end ``` which is fine once, but becomes tedious with many attributes Another possibility is allowing `attr_reader :cat?` to define a method that returns the value for ivar `@cat`. currently it raises `NameError (invalid attribute name `cat?')` Thank you -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>