Class: Pipetree::Function::Insert
- Inherits:
-
Object
- Object
- Pipetree::Function::Insert
- Defined in:
- lib/pipetree/insert.rb
Defined Under Namespace
Modules: Macros
Instance Method Summary collapse
Instance Method Details
#call(arr, func, options) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/pipetree/insert.rb', line 3 def call(arr, func, ) # arr = arr.dup operations = [:delete, :replace, :before, :after, :append, :prepend] # replace!(arr, options[:replace], func) .keys.reverse.each { |k| operations.include?(k) and return send("#{k}!", arr, [k], func) } raise "[Pipetree] Unknown command #{.inspect}" # TODO: test. # arr end |