Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/value-1.0.rb
Overview
Ruby’s Module class, extended to add #Value, a way of creating value object classes.
Instance Method Summary collapse
-
#Value(first, *rest, options = {}) ⇒ Object
Marks the module as a Value object with attributes FIRST and REST.
Instance Method Details
#Value(first, *rest, options = {}) ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/value-1.0.rb', line 121 def Value(first, *rest) = Hash === rest.last ? rest.pop : {} attributes = Value::Attributes.new(first, *rest.dup.push({:comparable => [:comparable]})) attr_reader(*attributes) protected(*attributes) define_method :attributes do attributes end private :attributes include Value::Comparable if [:comparable] include Value self end |