lib/tadpole/main.rb in tadpole-0.1.0 vs lib/tadpole/main.rb in tadpole-0.1.1

- old
+ new

@@ -3,13 +3,16 @@ end class Insertion def initialize(list, value) @list, @value = list, value end def before(val) insertion(val, 0) end - def after(val) insertion(val, 1) end + def after(val, ignore_subsections = true) insertion(val, 1, ignore_subsections) end private - def insertion(val, rel) + def insertion(val, rel, ignore_subsections = true) if index = @list.index(val) + if ignore_subsections && rel == 1 && @list[index + 1].is_a?(Array) + rel += 1 + end @list[index+rel,0] = @value end @list end end \ No newline at end of file