Class: RFunk::Tuple
- Inherits:
-
Object
- Object
- RFunk::Tuple
- Defined in:
- lib/rfunk/tuple.rb
Instance Method Summary collapse
-
#initialize(values) ⇒ Tuple
constructor
A new instance of Tuple.
- #value(*args) ⇒ Object
Constructor Details
#initialize(values) ⇒ Tuple
3 4 5 6 |
# File 'lib/rfunk/tuple.rb', line 3 def initialize(values) @values = values deep_freeze end |
Instance Method Details
#value(*args) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/rfunk/tuple.rb', line 8 def value(*args) index = args[0] if args.length == 1 RFunk.option(values[index]) else self.class.new(values.dup.tap { |v| v[index] = RFunk.option(args[1]) }) end end |