Module: Svnx::ObjectUtil::ClassMethods
- Included in:
- Svnx::ObjectUtil
- Defined in:
- lib/svnx/util/objutil.rb
Instance Method Summary collapse
- #attr_readers(*symbols) ⇒ Object
-
#xhas_fields(*fields) ⇒ Object
Creates a reader method for each field, and assigns and validates them from an initialize method, which is also created.
Instance Method Details
#attr_readers(*symbols) ⇒ Object
30 31 32 33 |
# File 'lib/svnx/util/objutil.rb', line 30 def attr_readers(*symbols) what = Array(symbols).flatten attr_reader(*what) end |
#xhas_fields(*fields) ⇒ Object
Creates a reader method for each field, and assigns and validates them from an initialize method, which is also created.
37 38 39 40 41 42 43 44 45 |
# File 'lib/svnx/util/objutil.rb', line 37 def xhas_fields(*fields) what = Array(fields).flatten attr_reader(*what) define_method :initialize do |args| assign args, what validate args, what end end |