Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/everythingrb/core/module.rb
Instance Method Summary collapse
-
#attr_predicate(*attributes) ⇒ nil
Creates predicate (boolean) methods for instance variables Similar to attr_reader, attr_writer, etc.
Instance Method Details
#attr_predicate(*attributes) ⇒ nil
Creates predicate (boolean) methods for instance variables Similar to attr_reader, attr_writer, etc.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/everythingrb/core/module.rb', line 18 def attr_predicate(*attributes) attributes.each do |attribute| module_eval <<-STR, __FILE__, __LINE__ + 1 def #{attribute}? !!instance_variable_get("@#{attribute}") end STR end nil end |