Add method to delete pages of the document by index - #1092
Conversation
19d64b2 to
0340db6
Compare
|
As we discussed, try to abstract to |
|
I wonder what is the use case for this feature. |
|
See #958. |
|
@sobrinho Thank you. I'm not convinced that use case warrants an addition to the library. |
|
@pointlessone this is a pattern that repeats over and over again in all projects that I work. It's okay if you think that doesn't belong to the core but would be a good helper for us! |
|
If you want each thing on its own page why don't you start a new page before rendering a thing? |
|
Because you can't start a new page in the first iteration, otherwise the blank page would be first one instead of the latest. In that case, the code is like that: things.each do |thing|
if things.first != thiing
document.start_new_page
end
render
end |
|
I see but I'm still hesitant since there's a straight-forward workaround and the code is not complex or obscure. |
|
Your call! Maybe there is other use cases, ours is just this one. |
|
Deleting a page at an index is valid request. Ideally it should support negative indexes ( The use case given is rather weak/inelegant however. |
0340db6 to
e7a948f
Compare
e7a948f to
862346a
Compare
|
@sobrinho @johnnyshields I've updated this PR. |
|
Awesome! |
|
@davidsilveira Please make Rubocop happy. Otherwise it's good. |
862346a to
20ced2e
Compare
pointlessone
left a comment
There was a problem hiding this comment.
Thank you for your contribution.
#958