Module: Qig::Qiggable

Defined in:
lib/qig/qiggable.rb

Overview

mix-in to add a .qig method to any class. NOTE: Target class should support #[], #map, and either #flat_map or #values for full qig functionality

  • #[]: used for stepping in unit context
  • #map: used for stepping in collection context
  • #flat_map or #values: used for unboxing in collection context

Instance Method Summary collapse

Instance Method Details

#lazyObject

see Enumerable#lazy

This version extends the underlying lazy enumerable with Qig::Qiggable



20
21
22
# File 'lib/qig/qiggable.rb', line 20

def lazy
  super.extend(Qig::Qiggable)
end

#qig(*path) ⇒ Object+

Returns the value(s) of self located at path.

Parameters:

  • path (Array<String, Symbol, Array, Object>)

    retrieval path to apply to subject

Returns:

  • (Object, Array<Object>)

    the value(s) of self located at path



13
14
15
# File 'lib/qig/qiggable.rb', line 13

def qig(*path)
  Qig.qig(self, *path)
end