Class: Insertion
- Inherits:
-
Object
- Object
- Insertion
- Defined in:
- lib/yard/core_ext/insertion.rb
Overview
The Insertion class inserts a value before or after another value in a list.
Instance Method Summary collapse
-
#after(val, recursive = false) ⇒ Object
Inserts the value after
val
. -
#after_any(val) ⇒ Object
Alias for #after with
recursive
set to true. -
#before(val, recursive = false) ⇒ Object
Inserts the value before
val
. -
#before_any(val) ⇒ Object
Alias for #before with
recursive
set to true. -
#initialize(list, value) ⇒ Insertion
constructor
Creates an insertion object on a list with a value to be inserted.
Constructor Details
Instance Method Details
#after(val, recursive = false) ⇒ Object
Inserts the value after val
.
26 |
# File 'lib/yard/core_ext/insertion.rb', line 26 def after(val, recursive = false) insertion(val, 1, recursive) end |
#after_any(val) ⇒ Object
Alias for #after with recursive
set to true
34 |
# File 'lib/yard/core_ext/insertion.rb', line 34 def after_any(val) insertion(val, 1, true) end |
#before(val, recursive = false) ⇒ Object
Inserts the value before val
18 |
# File 'lib/yard/core_ext/insertion.rb', line 18 def before(val, recursive = false) insertion(val, 0, recursive) end |
#before_any(val) ⇒ Object
Alias for #before with recursive
set to true
30 |
# File 'lib/yard/core_ext/insertion.rb', line 30 def before_any(val) insertion(val, 0, true) end |