Class: Pipeable::Steps::Insert
- Defined in:
- lib/pipeable/steps/insert.rb
Overview
Inserts elements before or after an object.
Constant Summary collapse
- LAST =
-1
Instance Method Summary collapse
- #call(result) ⇒ Object
-
#initialize(at: LAST) ⇒ Insert
constructor
A new instance of Insert.
Methods included from Composable
Constructor Details
Instance Method Details
#call(result) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/pipeable/steps/insert.rb', line 14 def call result result.fmap do |object| cast = object.is_a?(Array) ? object : [object] cast.insert(at, *base_positionals) end end |