Module: Tins::ClassMethod
Overview
This module provides convenient helpers for defining class methods and attributes on classes themselves.
Instance Method Summary collapse
-
#class_attr_accessor(*ids) ⇒ void
(also: #class_attr)
Define reader and writer attribute methods for all *ids.
-
#class_attr_reader(*ids) ⇒ void
Define reader attribute methods for all *ids.
-
#class_attr_writer(*ids) ⇒ void
Define writer attribute methods for all *ids.
-
#class_define_method(name) {|Object| ... } ⇒ void
Define a class method named name using block.
Methods included from Eigenclass
#eigenclass_class_eval, #eigenclass_eval
Instance Method Details
#class_attr_accessor(*ids) ⇒ void Also known as: class_attr
This method returns an undefined value.
Define reader and writer attribute methods for all *ids.
100 101 102 |
# File 'lib/tins/dslkit.rb', line 100 def class_attr_accessor(*ids) eigenclass_eval { attr_accessor(*ids) } end |
#class_attr_reader(*ids) ⇒ void
This method returns an undefined value.
Define reader attribute methods for all *ids.
113 114 115 |
# File 'lib/tins/dslkit.rb', line 113 def class_attr_reader(*ids) eigenclass_eval { attr_reader(*ids) } end |
#class_attr_writer(*ids) ⇒ void
This method returns an undefined value.
Define writer attribute methods for all *ids.
121 122 123 |
# File 'lib/tins/dslkit.rb', line 121 def class_attr_writer(*ids) eigenclass_eval { attr_writer(*ids) } end |
#class_define_method(name) {|Object| ... } ⇒ void
This method returns an undefined value.
Define a class method named name using block.
92 93 94 |
# File 'lib/tins/dslkit.rb', line 92 def class_define_method(name, &block) eigenclass_eval { define_method(name, &block) } end |