From 1c6b43d3a392d52a2ef12d031a4ac4a160884a9e Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Thu, 23 Dec 2021 00:59:21 -0500 Subject: Move docs to root of gh-pages site --- Array.html | 105 ++++ COPYING_txt.html | 299 +++++++++ Code-of-Conduct_md.html | 157 +++++ Contributing_md.html | 246 ++++++++ Diff.html | 91 +++ Diff/LCS/Internals.html | 360 +++++++++++ Diff/LCS/Ldiff.html | 91 +++ Fixnum.html | 134 ++++ History_md.html | 407 +++++++++++++ LCS.html | 1119 ++++++++++++++++++++++++++++++++++ LCS/Block.html | 240 ++++++++ LCS/Change.html | 500 +++++++++++++++ LCS/ContextChange.html | 353 +++++++++++ LCS/ContextDiffCallbacks.html | 255 ++++++++ LCS/DefaultCallbacks.html | 207 +++++++ LCS/DiffCallbacks.html | 305 +++++++++ LCS/HTMLDiff.html | 231 +++++++ LCS/Hunk.html | 397 ++++++++++++ LCS/SDiffCallbacks.html | 312 ++++++++++ License_md.html | 110 ++++ Manifest_txt.html | 91 +++ README_rdoc.html | 170 ++++++ String.html | 105 ++++ artistic_txt.html | 204 +++++++ created.rid | 21 + css/fonts.css | 167 +++++ css/rdoc.css | 639 +++++++++++++++++++ docs/Array.html | 105 ---- docs/Code-of-Conduct_md.html | 157 ----- docs/Contributing_md.html | 246 -------- docs/Diff.html | 91 --- docs/Diff/LCS/Internals.html | 360 ----------- docs/Diff/LCS/Ldiff.html | 91 --- docs/Fixnum.html | 134 ---- docs/History_md.html | 407 ------------- docs/LCS.html | 1119 ---------------------------------- docs/LCS/Block.html | 240 -------- docs/LCS/Change.html | 500 --------------- docs/LCS/ContextChange.html | 353 ----------- docs/LCS/ContextDiffCallbacks.html | 255 -------- docs/LCS/DefaultCallbacks.html | 207 ------- docs/LCS/DiffCallbacks.html | 305 --------- docs/LCS/HTMLDiff.html | 231 ------- docs/LCS/Hunk.html | 397 ------------ docs/LCS/SDiffCallbacks.html | 312 ---------- docs/License_md.html | 110 ---- docs/Manifest_txt.html | 91 --- docs/README_rdoc.html | 170 ------ docs/String.html | 105 ---- docs/created.rid | 21 - docs/css/fonts.css | 167 ----- docs/css/rdoc.css | 639 ------------------- docs/docs/COPYING_txt.html | 299 --------- docs/docs/artistic_txt.html | 204 ------- docs/fonts/Lato-Light.ttf | Bin 94668 -> 0 bytes docs/fonts/Lato-LightItalic.ttf | Bin 94196 -> 0 bytes docs/fonts/Lato-Regular.ttf | Bin 96184 -> 0 bytes docs/fonts/Lato-RegularItalic.ttf | Bin 95316 -> 0 bytes docs/fonts/SourceCodePro-Bold.ttf | Bin 71200 -> 0 bytes docs/fonts/SourceCodePro-Regular.ttf | Bin 71692 -> 0 bytes docs/images/add.png | Bin 733 -> 0 bytes docs/images/arrow_up.png | Bin 372 -> 0 bytes docs/images/brick.png | Bin 452 -> 0 bytes docs/images/brick_link.png | Bin 764 -> 0 bytes docs/images/bug.png | Bin 774 -> 0 bytes docs/images/bullet_black.png | Bin 211 -> 0 bytes docs/images/bullet_toggle_minus.png | Bin 207 -> 0 bytes docs/images/bullet_toggle_plus.png | Bin 209 -> 0 bytes docs/images/date.png | Bin 626 -> 0 bytes docs/images/delete.png | Bin 715 -> 0 bytes docs/images/find.png | Bin 659 -> 0 bytes docs/images/loadingAnimation.gif | Bin 5886 -> 0 bytes docs/images/macFFBgHack.png | Bin 207 -> 0 bytes docs/images/package.png | Bin 853 -> 0 bytes docs/images/page_green.png | Bin 621 -> 0 bytes docs/images/page_white_text.png | Bin 342 -> 0 bytes docs/images/page_white_width.png | Bin 309 -> 0 bytes docs/images/plugin.png | Bin 591 -> 0 bytes docs/images/ruby.png | Bin 592 -> 0 bytes docs/images/tag_blue.png | Bin 1880 -> 0 bytes docs/images/tag_green.png | Bin 613 -> 0 bytes docs/images/transparent.png | Bin 97 -> 0 bytes docs/images/wrench.png | Bin 610 -> 0 bytes docs/images/wrench_orange.png | Bin 584 -> 0 bytes docs/images/zoom.png | Bin 692 -> 0 bytes docs/index.html | 184 ------ docs/js/darkfish.js | 84 --- docs/js/navigation.js | 105 ---- docs/js/navigation.js.gz | Bin 833 -> 0 bytes docs/js/search.js | 110 ---- docs/js/search_index.js | 1 - docs/js/search_index.js.gz | Bin 3942 -> 0 bytes docs/js/searcher.js | 229 ------- docs/js/searcher.js.gz | Bin 1688 -> 0 bytes docs/table_of_contents.html | 717 ---------------------- fonts/Lato-Light.ttf | Bin 0 -> 94668 bytes fonts/Lato-LightItalic.ttf | Bin 0 -> 94196 bytes fonts/Lato-Regular.ttf | Bin 0 -> 96184 bytes fonts/Lato-RegularItalic.ttf | Bin 0 -> 95316 bytes fonts/SourceCodePro-Bold.ttf | Bin 0 -> 71200 bytes fonts/SourceCodePro-Regular.ttf | Bin 0 -> 71692 bytes images/add.png | Bin 0 -> 733 bytes images/arrow_up.png | Bin 0 -> 372 bytes images/brick.png | Bin 0 -> 452 bytes images/brick_link.png | Bin 0 -> 764 bytes images/bug.png | Bin 0 -> 774 bytes images/bullet_black.png | Bin 0 -> 211 bytes images/bullet_toggle_minus.png | Bin 0 -> 207 bytes images/bullet_toggle_plus.png | Bin 0 -> 209 bytes images/date.png | Bin 0 -> 626 bytes images/delete.png | Bin 0 -> 715 bytes images/find.png | Bin 0 -> 659 bytes images/loadingAnimation.gif | Bin 0 -> 5886 bytes images/macFFBgHack.png | Bin 0 -> 207 bytes images/package.png | Bin 0 -> 853 bytes images/page_green.png | Bin 0 -> 621 bytes images/page_white_text.png | Bin 0 -> 342 bytes images/page_white_width.png | Bin 0 -> 309 bytes images/plugin.png | Bin 0 -> 591 bytes images/ruby.png | Bin 0 -> 592 bytes images/tag_blue.png | Bin 0 -> 1880 bytes images/tag_green.png | Bin 0 -> 613 bytes images/transparent.png | Bin 0 -> 97 bytes images/wrench.png | Bin 0 -> 610 bytes images/wrench_orange.png | Bin 0 -> 584 bytes images/zoom.png | Bin 0 -> 692 bytes index.html | 184 ++++++ js/darkfish.js | 84 +++ js/navigation.js | 105 ++++ js/navigation.js.gz | Bin 0 -> 833 bytes js/search.js | 110 ++++ js/search_index.js | 1 + js/search_index.js.gz | Bin 0 -> 3942 bytes js/searcher.js | 229 +++++++ js/searcher.js.gz | Bin 0 -> 1688 bytes table_of_contents.html | 717 ++++++++++++++++++++++ 136 files changed, 8746 insertions(+), 8746 deletions(-) create mode 100644 Array.html create mode 100644 COPYING_txt.html create mode 100644 Code-of-Conduct_md.html create mode 100644 Contributing_md.html create mode 100644 Diff.html create mode 100644 Diff/LCS/Internals.html create mode 100644 Diff/LCS/Ldiff.html create mode 100644 Fixnum.html create mode 100644 History_md.html create mode 100644 LCS.html create mode 100644 LCS/Block.html create mode 100644 LCS/Change.html create mode 100644 LCS/ContextChange.html create mode 100644 LCS/ContextDiffCallbacks.html create mode 100644 LCS/DefaultCallbacks.html create mode 100644 LCS/DiffCallbacks.html create mode 100644 LCS/HTMLDiff.html create mode 100644 LCS/Hunk.html create mode 100644 LCS/SDiffCallbacks.html create mode 100644 License_md.html create mode 100644 Manifest_txt.html create mode 100644 README_rdoc.html create mode 100644 String.html create mode 100644 artistic_txt.html create mode 100644 created.rid create mode 100644 css/fonts.css create mode 100644 css/rdoc.css delete mode 100644 docs/Array.html delete mode 100644 docs/Code-of-Conduct_md.html delete mode 100644 docs/Contributing_md.html delete mode 100644 docs/Diff.html delete mode 100644 docs/Diff/LCS/Internals.html delete mode 100644 docs/Diff/LCS/Ldiff.html delete mode 100644 docs/Fixnum.html delete mode 100644 docs/History_md.html delete mode 100644 docs/LCS.html delete mode 100644 docs/LCS/Block.html delete mode 100644 docs/LCS/Change.html delete mode 100644 docs/LCS/ContextChange.html delete mode 100644 docs/LCS/ContextDiffCallbacks.html delete mode 100644 docs/LCS/DefaultCallbacks.html delete mode 100644 docs/LCS/DiffCallbacks.html delete mode 100644 docs/LCS/HTMLDiff.html delete mode 100644 docs/LCS/Hunk.html delete mode 100644 docs/LCS/SDiffCallbacks.html delete mode 100644 docs/License_md.html delete mode 100644 docs/Manifest_txt.html delete mode 100644 docs/README_rdoc.html delete mode 100644 docs/String.html delete mode 100644 docs/created.rid delete mode 100644 docs/css/fonts.css delete mode 100644 docs/css/rdoc.css delete mode 100644 docs/docs/COPYING_txt.html delete mode 100644 docs/docs/artistic_txt.html delete mode 100644 docs/fonts/Lato-Light.ttf delete mode 100644 docs/fonts/Lato-LightItalic.ttf delete mode 100644 docs/fonts/Lato-Regular.ttf delete mode 100644 docs/fonts/Lato-RegularItalic.ttf delete mode 100644 docs/fonts/SourceCodePro-Bold.ttf delete mode 100644 docs/fonts/SourceCodePro-Regular.ttf delete mode 100644 docs/images/add.png delete mode 100644 docs/images/arrow_up.png delete mode 100644 docs/images/brick.png delete mode 100644 docs/images/brick_link.png delete mode 100644 docs/images/bug.png delete mode 100644 docs/images/bullet_black.png delete mode 100644 docs/images/bullet_toggle_minus.png delete mode 100644 docs/images/bullet_toggle_plus.png delete mode 100644 docs/images/date.png delete mode 100644 docs/images/delete.png delete mode 100644 docs/images/find.png delete mode 100644 docs/images/loadingAnimation.gif delete mode 100644 docs/images/macFFBgHack.png delete mode 100644 docs/images/package.png delete mode 100644 docs/images/page_green.png delete mode 100644 docs/images/page_white_text.png delete mode 100644 docs/images/page_white_width.png delete mode 100644 docs/images/plugin.png delete mode 100644 docs/images/ruby.png delete mode 100644 docs/images/tag_blue.png delete mode 100644 docs/images/tag_green.png delete mode 100644 docs/images/transparent.png delete mode 100644 docs/images/wrench.png delete mode 100644 docs/images/wrench_orange.png delete mode 100644 docs/images/zoom.png delete mode 100644 docs/index.html delete mode 100644 docs/js/darkfish.js delete mode 100644 docs/js/navigation.js delete mode 100644 docs/js/navigation.js.gz delete mode 100644 docs/js/search.js delete mode 100644 docs/js/search_index.js delete mode 100644 docs/js/search_index.js.gz delete mode 100644 docs/js/searcher.js delete mode 100644 docs/js/searcher.js.gz delete mode 100644 docs/table_of_contents.html create mode 100644 fonts/Lato-Light.ttf create mode 100644 fonts/Lato-LightItalic.ttf create mode 100644 fonts/Lato-Regular.ttf create mode 100644 fonts/Lato-RegularItalic.ttf create mode 100644 fonts/SourceCodePro-Bold.ttf create mode 100644 fonts/SourceCodePro-Regular.ttf create mode 100644 images/add.png create mode 100644 images/arrow_up.png create mode 100644 images/brick.png create mode 100644 images/brick_link.png create mode 100644 images/bug.png create mode 100644 images/bullet_black.png create mode 100644 images/bullet_toggle_minus.png create mode 100644 images/bullet_toggle_plus.png create mode 100644 images/date.png create mode 100644 images/delete.png create mode 100644 images/find.png create mode 100644 images/loadingAnimation.gif create mode 100644 images/macFFBgHack.png create mode 100644 images/package.png create mode 100644 images/page_green.png create mode 100644 images/page_white_text.png create mode 100644 images/page_white_width.png create mode 100644 images/plugin.png create mode 100644 images/ruby.png create mode 100644 images/tag_blue.png create mode 100644 images/tag_green.png create mode 100644 images/transparent.png create mode 100644 images/wrench.png create mode 100644 images/wrench_orange.png create mode 100644 images/zoom.png create mode 100644 index.html create mode 100644 js/darkfish.js create mode 100644 js/navigation.js create mode 100644 js/navigation.js.gz create mode 100644 js/search.js create mode 100644 js/search_index.js create mode 100644 js/search_index.js.gz create mode 100644 js/searcher.js create mode 100644 js/searcher.js.gz create mode 100644 table_of_contents.html diff --git a/Array.html b/Array.html new file mode 100644 index 0000000..2a6d8e5 --- /dev/null +++ b/Array.html @@ -0,0 +1,105 @@ + + + + + + +class Array - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class Array +

+ +
+ +
+ +
+ + + + + +
+
+ + + + diff --git a/COPYING_txt.html b/COPYING_txt.html new file mode 100644 index 0000000..b0b2816 --- /dev/null +++ b/COPYING_txt.html @@ -0,0 +1,299 @@ + + + + + + +COPYING - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+ +
                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+                           Preamble
+
+ The licenses for most software are designed to take away your
+ +

freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software–to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.

+ +
When we speak of free software, we are referring to freedom, not
+ +

price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

+ +
To protect your rights, we need to make restrictions that forbid
+ +

anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

+ +
For example, if you distribute copies of such a program, whether
+ +

gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

+ +
We protect your rights with two steps: (1) copyright the software, and
+ +

(2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

+ +
Also, for each author's protection and ours, we want to make certain
+ +

that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

+ +
Finally, any free program is threatened constantly by software
+ +

patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

+ +
The precise terms and conditions for copying, distribution and
+ +

modification follow.

+ +
                  GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains
+ +

a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The “Program”, below, refers to any such program or work, and a “work based on the Program” means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term “modification”.) Each licensee is addressed as “you”.

+ +

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

+ +
1. You may copy and distribute verbatim copies of the Program's
+ +

source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

+ +

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

+ +
2. You may modify your copy or copies of the Program or any portion
+
+ +

of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

+ +
a) You must cause the modified files to carry prominent notices
+stating that you changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in
+whole or in part contains or is derived from the Program or any
+part thereof, to be licensed as a whole at no charge to all third
+parties under the terms of this License.
+
+c) If the modified program normally reads commands interactively
+when run, you must cause it, when started running for such
+interactive use in the most ordinary way, to print or display an
+announcement including an appropriate copyright notice and a
+notice that there is no warranty (or else, saying that you provide
+a warranty) and that users may redistribute the program under
+these conditions, and telling the user how to view a copy of this
+License.  (Exception: if the Program itself is interactive but
+does not normally print such an announcement, your work based on
+the Program is not required to print an announcement.)
+ +

These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

+ +

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

+ +

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

+ +
3. You may copy and distribute the Program (or a work based on it,
+ +

under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

+ +
a) Accompany it with the complete corresponding machine-readable
+source code, which must be distributed under the terms of Sections
+1 and 2 above on a medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three
+years, to give any third party, for a charge no more than your
+cost of physically performing source distribution, a complete
+machine-readable copy of the corresponding source code, to be
+distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange; or,
+
+c) Accompany it with the information you received as to the offer
+to distribute corresponding source code.  (This alternative is
+allowed only for noncommercial distribution and only if you
+received the program in object code or executable form with such
+an offer, in accord with Subsection b above.)
+ +

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

+ +

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

+ +
4. You may not copy, modify, sublicense, or distribute the Program
+ +

except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

+ +
5. You are not required to accept this License, since you have not
+ +

signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

+ +
6. Each time you redistribute the Program (or any work based on the
+ +

Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

+ +
7. If, as a consequence of a court judgment or allegation of patent
+ +

infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

+ +

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

+ +

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

+ +

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

+ +
8. If the distribution and/or use of the Program is restricted in
+ +

certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

+ +
9. The Free Software Foundation may publish revised and/or new versions
+ +

of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

+ +

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and “any later version”, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

+ +
10. If you wish to incorporate parts of the Program into other free
+
+ +

programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

+ +
                          NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+ +

FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

+ +
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+
+ +

WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

+ +
                   END OF TERMS AND CONDITIONS
+
+          How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest
+ +

possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

+ +
To do so, attach the following notices to the program.  It is safest
+ +

to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.

+ +
<one line to give the program's name and a brief idea of what it does.>
+Copyright (C) <year>  <name of author>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ +

Also add information on how to contact you by electronic and paper mail.

+ +

If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

+ +
Gnomovision version 69, Copyright (C) year name of author
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+ +

The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items–whatever suits your program.

+ +

You should also get your employer (if you work as a programmer) or your school, if any, to sign a “copyright disclaimer” for the program, if necessary. Here is a sample; alter the names:

+ +
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+`Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+<signature of Ty Coon>, 1 April 1989
+Ty Coon, President of Vice
+ +

This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.

+ +
+ + + + + diff --git a/Code-of-Conduct_md.html b/Code-of-Conduct_md.html new file mode 100644 index 0000000..c8f7f5d --- /dev/null +++ b/Code-of-Conduct_md.html @@ -0,0 +1,157 @@ + + + + + + +Code-of-Conduct - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+ +

Contributor Covenant Code of Conduct

+ +

Our Pledge

+ +

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

+ +

Our Standards

+ +

Examples of behavior that contributes to creating a positive environment include:

+ + +

Examples of unacceptable behavior by participants include:

+ + +

Our Responsibilities

+ +

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

+ +

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

+ +

Scope

+ +

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

+ +

Enforcement

+ +

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [INSERT EMAIL ADDRESS]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

+ +

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

+ +

Attribution

+ +

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at contributor-covenant.org/version/1/4

+ +
+ + + + + diff --git a/Contributing_md.html b/Contributing_md.html new file mode 100644 index 0000000..09d1a46 --- /dev/null +++ b/Contributing_md.html @@ -0,0 +1,246 @@ + + + + + + +Contributing - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+ +

Contributing

+ +

I value any contribution to Diff::LCS you can provide: a bug report, a feature request, or code contributions. Code contributions to Diff::LCS are especially <del>welcome</del>encouraged. Because Diff::LCS is a complex codebase, there are a few guidelines:

+ + +

Test Dependencies

+ +

Diff::LCS uses Ryan Davis’s [Hoe][] to manage the release process, and it adds a number of rake tasks. You will mostly be interested in:

+ +
$ rake
+ +

which runs the tests the same way that:

+ +
$ rake spec
+ +

will do.

+ +

To assist with the installation of the development dependencies, I have provided a Gemfile pointing to the (generated) diff-lcs.gemspec file. This will permit you to do:

+ +
$ bundle install
+ +

to get the development dependencies. If you aleady have hoe installed, you can accomplish the same thing with:

+ +
$ rake newb
+ +

This task will install any missing dependencies, run the tests/specs, and generate the RDoc.

+ +

You can run tests with code coverage analysis by running:

+ +
$ rake spec:coverage
+ +

Workflow

+ +

Here's the most direct way to get your work merged into the project:

+ + +

Contributors

+ + +

Thanks to everyone else who has contributed code or bug reports to Diff::LCS:

+ + +
+ + + + + diff --git a/Diff.html b/Diff.html new file mode 100644 index 0000000..8fa95fe --- /dev/null +++ b/Diff.html @@ -0,0 +1,91 @@ + + + + + + +module Diff - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ module Diff +

+ +
+ +
+ +
+ + + + + +
+
+ + + + diff --git a/Diff/LCS/Internals.html b/Diff/LCS/Internals.html new file mode 100644 index 0000000..b1ccf43 --- /dev/null +++ b/Diff/LCS/Internals.html @@ -0,0 +1,360 @@ + + + + + + +module Diff::LCS::Internals - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ module Diff::LCS::Internals +

+ +
+ +
+ +
+ + + + + +
+
+

Public Class Methods

+
+ +
+
+ analyze_patchset(patchset, depth = 0) + click to toggle source +
+ +
+

This method will analyze the provided patchset to provide a single-pass normalization (conversion of the array form of Diff::LCS::Change objects to the object form of same) and detection of whether the patchset represents changes to be made.

+ +
+
# File lib/diff/lcs/internals.rb, line 102
+def analyze_patchset(patchset, depth = 0)
+  fail 'Patchset too complex' if depth > 1
+
+  has_changes = false
+  new_patchset = []
+
+  # Format:
+  # [ # patchset
+  #   # hunk (change)
+  #   [ # hunk
+  #     # change
+  #   ]
+  # ]
+
+  patchset.each do |hunk|
+    case hunk
+    when Diff::LCS::Change
+      has_changes ||= !hunk.unchanged?
+      new_patchset << hunk
+    when Array
+      # Detect if the 'hunk' is actually an array-format change object.
+      if Diff::LCS::Change.valid_action? hunk[0]
+        hunk = Diff::LCS::Change.from_a(hunk)
+        has_changes ||= !hunk.unchanged?
+        new_patchset << hunk
+      else
+        with_changes, hunk = analyze_patchset(hunk, depth + 1)
+        has_changes ||= with_changes
+        new_patchset.concat(hunk)
+      end
+    else
+      fail ArgumentError, "Cannot normalise a hunk of class #{hunk.class}."
+    end
+  end
+
+  [has_changes, new_patchset]
+end
+
+
+ + +
+ +
+
+ intuit_diff_direction(src, patchset, limit = nil) + click to toggle source +
+ +
+

Examine the patchset and the source to see in which direction the patch should be applied.

+ +

WARNING: By default, this examines the whole patch, so this could take some time. This also works better with Diff::LCS::ContextChange or Diff::LCS::Change as its source, as an array will cause the creation of one of the above.

+ +
+
# File lib/diff/lcs/internals.rb, line 147
+  def intuit_diff_direction(src, patchset, limit = nil)
+    string = src.kind_of?(String)
+    count = left_match = left_miss = right_match = right_miss = 0
+
+    patchset.each do |change|
+      count += 1
+
+      case change
+      when Diff::LCS::ContextChange
+        le = string ? src[change.old_position, 1] : src[change.old_position]
+        re = string ? src[change.new_position, 1] : src[change.new_position]
+
+        case change.action
+        when '-' # Remove details from the old string
+          if le == change.old_element
+            left_match += 1
+          else
+            left_miss += 1
+          end
+        when '+'
+          if re == change.new_element
+            right_match += 1
+          else
+            right_miss += 1
+          end
+        when '='
+          left_miss += 1 if le != change.old_element
+          right_miss += 1 if re != change.new_element
+        when '!'
+          if le == change.old_element
+            left_match += 1
+          elsif re == change.new_element
+            right_match += 1
+          else
+            left_miss += 1
+            right_miss += 1
+          end
+        end
+      when Diff::LCS::Change
+        # With a simplistic change, we can't tell the difference between
+        # the left and right on '!' actions, so we ignore those. On '='
+        # actions, if there's a miss, we miss both left and right.
+        element = string ? src[change.position, 1] : src[change.position]
+
+        case change.action
+        when '-'
+          if element == change.element
+            left_match += 1
+          else
+            left_miss += 1
+          end
+        when '+'
+          if element == change.element
+            right_match += 1
+          else
+            right_miss += 1
+          end
+        when '='
+          if element != change.element
+            left_miss += 1
+            right_miss += 1
+          end
+        end
+      end
+
+      break if !limit.nil? && (count > limit)
+    end
+
+    no_left = left_match.zero? && left_miss.positive?
+    no_right = right_match.zero? && right_miss.positive?
+
+    case [no_left, no_right]
+    when [false, true]
+      :patch
+    when [true, false]
+      :unpatch
+    else
+      case left_match <=> right_match
+      when 1
+        if left_miss.zero?
+          :patch
+        else
+          :unpatch
+        end
+      when -1
+        if right_miss.zero?
+          :unpatch
+        else
+          :patch
+        end
+      else
+        fail "The provided patchset does not appear to apply to the provided \
+enumerable as either source or destination value."
+      end
+    end
+  end
+
+
+ + +
+ +
+
+ lcs(a, b) + click to toggle source +
+ +
+

Compute the longest common subsequence between the sequenced Enumerables a and b. The result is an array whose contents is such that

+ +
result = Diff::LCS::Internals.lcs(a, b)
+result.each_with_index do |e, i|
+  assert_equal(a[i], b[e]) unless e.nil?
+end
+
+ +
+
# File lib/diff/lcs/internals.rb, line 41
+def lcs(a, b)
+  a_start = b_start = 0
+  a_finish = a.size - 1
+  b_finish = b.size - 1
+  vector = []
+
+  # Collect any common elements at the beginning...
+  while (a_start <= a_finish) and (b_start <= b_finish) and (a[a_start] == b[b_start])
+    vector[a_start] = b_start
+    a_start += 1
+    b_start += 1
+  end
+
+  # Now the end...
+  while (a_start <= a_finish) and (b_start <= b_finish) and (a[a_finish] == b[b_finish])
+    vector[a_finish] = b_finish
+    a_finish -= 1
+    b_finish -= 1
+  end
+
+  # Now, compute the equivalence classes of positions of elements.
+  # An explanation for how this works: https://codeforces.com/topic/92191
+  b_matches = position_hash(b, b_start..b_finish)
+
+  thresh = []
+  links  = []
+  string = a.kind_of?(String)
+
+  (a_start..a_finish).each do |i|
+    ai = string ? a[i, 1] : a[i]
+    bm = b_matches[ai]
+    k = nil
+    bm.reverse_each do |j|
+      # Although the threshold check is not mandatory for this to work,
+      # it may have an optimization purpose
+      # An attempt to remove it: https://github.com/halostatue/diff-lcs/pull/72
+      # Why it is reintroduced: https://github.com/halostatue/diff-lcs/issues/78
+      if k and (thresh[k] > j) and (thresh[k - 1] < j)
+        thresh[k] = j
+      else
+        k = replace_next_larger(thresh, j, k)
+      end
+      links[k] = [k.positive? ? links[k - 1] : nil, i, j] unless k.nil?
+    end
+  end
+
+  unless thresh.empty?
+    link = links[thresh.size - 1]
+    until link.nil?
+      vector[link[1]] = link[2]
+      link = link[0]
+    end
+  end
+
+  vector
+end
+
+
+ + +
+ +
+ +
+
+ + + + diff --git a/Diff/LCS/Ldiff.html b/Diff/LCS/Ldiff.html new file mode 100644 index 0000000..3b618d6 --- /dev/null +++ b/Diff/LCS/Ldiff.html @@ -0,0 +1,91 @@ + + + + + + +module Diff::LCS::Ldiff - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ module Diff::LCS::Ldiff +

+ +
+ +
+ +
+ + + + + +
+
+ + + + diff --git a/Fixnum.html b/Fixnum.html new file mode 100644 index 0000000..69b409d --- /dev/null +++ b/Fixnum.html @@ -0,0 +1,134 @@ + + + + + + +class Fixnum - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class Fixnum +

+ +
+ +
+ +
+ + + + + +
+
+

Public Instance Methods

+
+ +
+
+ positive?() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/backports.rb, line 5
+def positive?
+  self > 0 # rubocop:disable Style/NumericPredicate
+end
+
+
+ + +
+ +
+ +
+
+ + + + diff --git a/History_md.html b/History_md.html new file mode 100644 index 0000000..b071f53 --- /dev/null +++ b/History_md.html @@ -0,0 +1,407 @@ + + + + + + +History - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+ +

History

+ +

1.5.0 / 2021-12-23

+ + +

1.4.4 / 2020-07-01

+ + +

1.4.3 / 2020-06-29

+ + +

Resolves #63.

+ +

1.4.2 / 2020-06-23

+ + +

1.4.1 / 2020-06-23

+ + +

1.4 / 2020-06-23

+ + +

1.3 / 2017-01-18

+ + +

1.2.5 / 2013-11-08

+ + +

1.2.4 / 2013-04-20

+ + +

1.2.3 / 2013-04-11

+ + +

1.2.2 / 2013-03-30

+ + +

1.2.1 / 2013-02-09

+ + +

1.2.0 / 2013-01-21

+ + +

1.1.3 / 2011-08-27

+ + +

1.1.2 / 2004-10-20

+ + +

1.1.1 / 2004-09-25

+ + +

1.1.0

+ + +

1.0.4

+ + +

1.0.3

+ + +

1.0.2

+ + +

1.0.1

+ + +

1.0

+ + +
+ + + + + diff --git a/LCS.html b/LCS.html new file mode 100644 index 0000000..ef19930 --- /dev/null +++ b/LCS.html @@ -0,0 +1,1119 @@ + + + + + + +module LCS - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ module LCS +

+ +
+ +

How Diff Works (by Mark-Jason Dominus)

+ +

I once read an article written by the authors of diff; they said that they hard worked very hard on the algorithm until they found the right one.

+ +

I think what they ended up using (and I hope someone will correct me, because I am not very confident about this) was the `longest common subsequence' method. In the LCS problem, you have two sequences of items:

+ +
a b c d f g h j q z
+a b c d e f g i j k r x y z
+
+ +

and you want to find the longest sequence of items that is present in both original sequences in the same order. That is, you want to find a new sequence S which can be obtained from the first sequence by deleting some items, and from the second sequence by deleting other items. You also want S to be as long as possible. In this case S is:

+ +
a b c d f g j z
+
+ +

From there it's only a small step to get diff-like output:

+ +
e   h i   k   q r x y
++   - +   +   - + + +
+ +

This module solves the LCS problem. It also includes a canned function to generate diff-like output.

+ +

It might seem from the example above that the LCS of two sequences is always pretty obvious, but that's not always the case, especially when the two sequences have many repeated elements. For example, consider

+ +
a x b y c z p d q
+a b c a x b y c z
+
+ +

A naive approach might start by matching up the a and b that appear at the beginning of each sequence, like this:

+ +
a x b y c         z p d q
+a   b   c a b y c z
+
+ +

This finds the common subsequence +a b c z+. But actually, the LCS is +a x b y c z+:

+ +
      a x b y c z p d q
+a b c a x b y c z
+
+ +
+ +
+ + +
+
+

Constants

+
+
+
BalancedCallbacks +

This callback object implements the default set of callback events, which only returns the event itself. Note that finished_a and finished_b are not implemented – I haven't yet figured out where they would be useful.

+ +

Note that this is intended to be called as is, e.g.,

+ +
Diff::LCS.LCS(seq1, seq2, Diff::LCS::DefaultCallbacks)
+
+
SequenceCallbacks +

This callback object implements the default set of callback events, which only returns the event itself. Note that finished_a and finished_b are not implemented – I haven't yet figured out where they would be useful.

+ +

Note that this is intended to be called as is, e.g.,

+ +
Diff::LCS.LCS(seq1, seq2, Diff::LCS::DefaultCallbacks)
+
+
VERSION +
+
+
+ + + +
+
+

Public Class Methods

+
+ +
+
+ LCS(seq1, seq2, &block) +
+ +
+ + +
+ + +
+ Alias for: lcs +
+
+ +
+
+ callbacks_for(callbacks) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 52
+def self.callbacks_for(callbacks)
+  callbacks.new rescue callbacks
+end
+
+
+ + +
+ +
+
+ diff(seq1, seq2, callbacks = nil, &block) + click to toggle source +
+ +
+

diff computes the smallest set of additions and deletions necessary to turn the first sequence into the second, and returns a description of these changes.

+ +

See Diff::LCS::DiffCallbacks for the default behaviour. An alternate behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a Class argument is provided for callbacks, diff will attempt to initialise it. If the callbacks object (possibly initialised) responds to finish, it will be called.

+ +
+
# File lib/diff/lcs.rb, line 168
+def diff(seq1, seq2, callbacks = nil, &block) # :yields diff changes:
+  diff_traversal(:diff, seq1, seq2, callbacks || Diff::LCS::DiffCallbacks, &block)
+end
+
+
+ + +
+ +
+
+ lcs(seq1, seq2, &block) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs.rb, line 144
+def lcs(seq1, seq2, &block) #:yields seq1[i] for each matched:
+  matches = Diff::LCS::Internals.lcs(seq1, seq2)
+  ret = []
+  string = seq1.kind_of? String
+  matches.each_with_index do |_e, i|
+    next if matches[i].nil?
+
+    v = string ? seq1[i, 1] : seq1[i]
+    v = block[v] if block
+    ret << v
+  end
+  ret
+end
+
+
+ +
+ Also aliased as: LCS +
+ +
+ +
+
+ patch(src, patchset, direction = nil) + click to toggle source +
+ +
+

Applies a patchset to the sequence src according to the direction (:patch or :unpatch), producing a new sequence.

+ +

If the direction is not specified, Diff::LCS::patch will attempt to discover the direction of the patchset.

+ +

A patchset can be considered to apply forward (:patch) if the following expression is true:

+ +
patch(s1, diff(s1, s2)) -> s2
+ +

A patchset can be considered to apply backward (:unpatch) if the following expression is true:

+ +
patch(s2, diff(s1, s2)) -> s1
+ +

If the patchset contains no changes, the src value will be returned as either src.dup or src. A patchset can be deemed as having no changes if the following predicate returns true:

+ +
patchset.empty? or
+  patchset.flatten(1).all? { |change| change.unchanged? }
+
+ +

Patchsets

+ +

A patchset is always an enumerable sequence of changes, hunks of changes, or a mix of the two. A hunk of changes is an enumerable sequence of changes:

+ +
[ # patchset
+  # change
+  [ # hunk
+    # change
+  ]
+]
+
+ +

The patch method accepts patchsets that are enumerable sequences containing either Diff::LCS::Change objects (or a subclass) or the array representations of those objects. Prior to application, array representations of Diff::LCS::Change objects will be reified.

+ +
+
# File lib/diff/lcs.rb, line 624
+def patch(src, patchset, direction = nil)
+  # Normalize the patchset.
+  has_changes, patchset = Diff::LCS::Internals.analyze_patchset(patchset)
+
+  return src.respond_to?(:dup) ? src.dup : src unless has_changes
+
+  string = src.kind_of?(String)
+  # Start with a new empty type of the source's class
+  res = src.class.new
+
+  direction ||= Diff::LCS::Internals.intuit_diff_direction(src, patchset)
+
+  ai = bj = 0
+
+  patch_map = PATCH_MAP[direction]
+
+  patchset.each do |change|
+    # Both Change and ContextChange support #action
+    action = patch_map[change.action]
+
+    case change
+    when Diff::LCS::ContextChange
+      case direction
+      when :patch
+        el = change.new_element
+        op = change.old_position
+        np = change.new_position
+      when :unpatch
+        el = change.old_element
+        op = change.new_position
+        np = change.old_position
+      end
+
+      case action
+      when '-' # Remove details from the old string
+        while ai < op
+          res << (string ? src[ai, 1] : src[ai])
+          ai += 1
+          bj += 1
+        end
+        ai += 1
+      when '+'
+        while bj < np
+          res << (string ? src[ai, 1] : src[ai])
+          ai += 1
+          bj += 1
+        end
+
+        res << el
+        bj += 1
+      when '='
+        # This only appears in sdiff output with the SDiff callback.
+        # Therefore, we only need to worry about dealing with a single
+        # element.
+        res << el
+
+        ai += 1
+        bj += 1
+      when '!'
+        while ai < op
+          res << (string ? src[ai, 1] : src[ai])
+          ai += 1
+          bj += 1
+        end
+
+        bj += 1
+        ai += 1
+
+        res << el
+      end
+    when Diff::LCS::Change
+      case action
+      when '-'
+        while ai < change.position
+          res << (string ? src[ai, 1] : src[ai])
+          ai += 1
+          bj += 1
+        end
+        ai += 1
+      when '+'
+        while bj < change.position
+          res << (string ? src[ai, 1] : src[ai])
+          ai += 1
+          bj += 1
+        end
+
+        bj += 1
+
+        res << change.element
+      end
+    end
+  end
+
+  while ai < src.size
+    res << (string ? src[ai, 1] : src[ai])
+    ai += 1
+    bj += 1
+  end
+
+  res
+end
+
+
+ + +
+ +
+
+ patch!(src, patchset) + click to toggle source +
+ +
+

Given a set of patchset, convert the current version to the next version. Does no auto-discovery.

+ +
+
# File lib/diff/lcs.rb, line 734
+def patch!(src, patchset)
+  patch(src, patchset, :patch)
+end
+
+
+ + +
+ +
+
+ sdiff(seq1, seq2, callbacks = nil, &block) + click to toggle source +
+ +
+

sdiff computes all necessary components to show two sequences and their minimized differences side by side, just like the Unix utility sdiff does:

+ +
old        <     -
+same             same
+before     |     after
+-          >     new
+ +

See Diff::LCS::SDiffCallbacks for the default behaviour. An alternate behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a Class argument is provided for callbacks, diff will attempt to initialise it. If the callbacks object (possibly initialised) responds to finish, it will be called.

+ +

Each element of a returned array is a Diff::LCS::ContextChange object, which can be implicitly converted to an array.

+ +
Diff::LCS.sdiff(a, b).each do |action, (old_pos, old_element), (new_pos, new_element)|
+  case action
+  when '!'
+    # replace
+  when '-'
+    # delete
+  when '+'
+    # insert
+  end
+end
+
+ +
+
# File lib/diff/lcs.rb, line 200
+def sdiff(seq1, seq2, callbacks = nil, &block) #:yields diff changes:
+  diff_traversal(:sdiff, seq1, seq2, callbacks || Diff::LCS::SDiffCallbacks, &block)
+end
+
+
+ + +
+ +
+
+ traverse_balanced(seq1, seq2, callbacks = Diff::LCS::BalancedCallbacks) { |event| ... } + click to toggle source +
+ +
+

traverse_balanced is an alternative to traverse_sequences. It uses a different algorithm to iterate through the entries in the computed longest common subsequence. Instead of viewing the changes as insertions or deletions from one of the sequences, traverse_balanced will report changes between the sequences.

+ +

The arguments to traverse_balanced are the two sequences to traverse and a callback object, like this:

+ +
traverse_balanced(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
+
+ +

sdiff is implemented with traverse_balanced.

+ +

Callback Methods

+ +

Optional callback methods are emphasized.

+
callbacks#match +
+

Called when a and b are pointing to common elements in A and B.

+
callbacks#discard_a +
+

Called when a is pointing to an element not in B.

+
callbacks#discard_b +
+

Called when b is pointing to an element not in A.

+
callbacks#change +
+

Called when a and b are pointing to the same relative position, but A[a] and B[b] are not the same; a change has occurred.

+
+ +

traverse_balanced might be a bit slower than traverse_sequences, noticable only while processing huge amounts of data.

+ +

Algorithm

+ +
a---+
+    v
+A = a b c e h j l m n p
+B = b c d e f j k l m r s t
+    ^
+b---+
+ +

Matches

+ +

If there are two arrows (a and b) pointing to elements of sequences A and B, the arrows will initially point to the first elements of their respective sequences. traverse_sequences will advance the arrows through the sequences one element at a time, calling a method on the user-specified callback object before each advance. It will advance the arrows in such a way that if there are elements A[i] and B[j] which are both equal and part of the longest common subsequence, there will be some moment during the execution of traverse_sequences when arrow a is pointing to A[i] and arrow b is pointing to B[j]. When this happens, traverse_sequences will call callbacks#match and then it will advance both arrows.

+ +

Discards

+ +

Otherwise, one of the arrows is pointing to an element of its sequence that is not part of the longest common subsequence. traverse_sequences will advance that arrow and will call callbacks#discard_a or callbacks#discard_b, depending on which arrow it advanced.

+ +

Changes

+ +

If both a and b point to elements that are not part of the longest common subsequence, then traverse_sequences will try to call callbacks#change and advance both arrows. If callbacks#change is not implemented, then callbacks#discard_a and callbacks#discard_b will be called in turn.

+ +

The methods for callbacks#match, callbacks#discard_a, callbacks#discard_b, and callbacks#change are invoked with an event comprising the action (“=”, “+”, “-”, or “!”, respectively), the indicies i and j, and the elements A[i] and B[j]. Return values are discarded by traverse_balanced.

+ +

Context

+ +

Note that i and j may not be the same index position, even if a and b are considered to be pointing to matching or changed elements.

+ +
+
# File lib/diff/lcs.rb, line 475
+def traverse_balanced(seq1, seq2, callbacks = Diff::LCS::BalancedCallbacks)
+  matches = Diff::LCS::Internals.lcs(seq1, seq2)
+  a_size = seq1.size
+  b_size = seq2.size
+  ai = bj = mb = 0
+  ma = -1
+  string = seq1.kind_of?(String)
+
+  # Process all the lines in the match vector.
+  loop do
+    # Find next match indices +ma+ and +mb+
+    loop do
+      ma += 1
+      break unless ma < matches.size and matches[ma].nil?
+    end
+
+    break if ma >= matches.size # end of matches?
+
+    mb = matches[ma]
+
+    # Change(seq2)
+    while (ai < ma) or (bj < mb)
+      ax = string ? seq1[ai, 1] : seq1[ai]
+      bx = string ? seq2[bj, 1] : seq2[bj]
+
+      case [(ai < ma), (bj < mb)]
+      when [true, true]
+        if callbacks.respond_to?(:change)
+          event = Diff::LCS::ContextChange.new('!', ai, ax, bj, bx)
+          event = yield event if block_given?
+          callbacks.change(event)
+          ai += 1
+        else
+          event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+          event = yield event if block_given?
+          callbacks.discard_a(event)
+          ai += 1
+          ax = string ? seq1[ai, 1] : seq1[ai]
+          event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+          event = yield event if block_given?
+          callbacks.discard_b(event)
+        end
+
+        bj += 1
+      when [true, false]
+        event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+        event = yield event if block_given?
+        callbacks.discard_a(event)
+        ai += 1
+      when [false, true]
+        event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+        event = yield event if block_given?
+        callbacks.discard_b(event)
+        bj += 1
+      end
+    end
+
+    # Match
+    ax = string ? seq1[ai, 1] : seq1[ai]
+    bx = string ? seq2[bj, 1] : seq2[bj]
+    event = Diff::LCS::ContextChange.new('=', ai, ax, bj, bx)
+    event = yield event if block_given?
+    callbacks.match(event)
+    ai += 1
+    bj += 1
+  end
+
+  while (ai < a_size) or (bj < b_size)
+    ax = string ? seq1[ai, 1] : seq1[ai]
+    bx = string ? seq2[bj, 1] : seq2[bj]
+
+    case [(ai < a_size), (bj < b_size)]
+    when [true, true]
+      if callbacks.respond_to?(:change)
+        event = Diff::LCS::ContextChange.new('!', ai, ax, bj, bx)
+        event = yield event if block_given?
+        callbacks.change(event)
+        ai += 1
+      else
+        event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+        event = yield event if block_given?
+        callbacks.discard_a(event)
+        ai += 1
+        ax = string ? seq1[ai, 1] : seq1[ai]
+        event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+        event = yield event if block_given?
+        callbacks.discard_b(event)
+      end
+
+      bj += 1
+    when [true, false]
+      event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+      event = yield event if block_given?
+      callbacks.discard_a(event)
+      ai += 1
+    when [false, true]
+      event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+      event = yield event if block_given?
+      callbacks.discard_b(event)
+      bj += 1
+    end
+  end
+end
+
+
+ + +
+ +
+
+ traverse_sequences(seq1, seq2, callbacks = Diff::LCS::SequenceCallbacks) { |event| ... } + click to toggle source +
+ +
+

traverse_sequences is the most general facility provided by this module; diff and lcs are implemented as calls to it.

+ +

The arguments to traverse_sequences are the two sequences to traverse, and a callback object, like this:

+ +
traverse_sequences(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
+
+ +

Callback Methods

+ +

Optional callback methods are emphasized.

+
callbacks#match +
+

Called when a and b are pointing to common elements in A and B.

+
callbacks#discard_a +
+

Called when a is pointing to an element not in B.

+
callbacks#discard_b +
+

Called when b is pointing to an element not in A.

+
callbacks#finished_a +
+

Called when a has reached the end of sequence A.

+
callbacks#finished_b +
+

Called when b has reached the end of sequence B.

+
+ +

Algorithm

+ +
a---+
+    v
+A = a b c e h j l m n p
+B = b c d e f j k l m r s t
+    ^
+b---+
+ +

If there are two arrows (a and b) pointing to elements of sequences A and B, the arrows will initially point to the first elements of their respective sequences. traverse_sequences will advance the arrows through the sequences one element at a time, calling a method on the user-specified callback object before each advance. It will advance the arrows in such a way that if there are elements A[i] and B[j] which are both equal and part of the longest common subsequence, there will be some moment during the execution of traverse_sequences when arrow a is pointing to A[i] and arrow b is pointing to B[j]. When this happens, traverse_sequences will call callbacks#match and then it will advance both arrows.

+ +

Otherwise, one of the arrows is pointing to an element of its sequence that is not part of the longest common subsequence. traverse_sequences will advance that arrow and will call callbacks#discard_a or callbacks#discard_b, depending on which arrow it advanced. If both arrows point to elements that are not part of the longest common subsequence, then traverse_sequences will advance arrow a and call the appropriate callback, then it will advance arrow b and call the appropriate callback.

+ +

The methods for callbacks#match, callbacks#discard_a, and callbacks#discard_b are invoked with an event comprising the action (“=”, “+”, or “-”, respectively), the indicies i and j, and the elements A[i] and B[j]. Return values are discarded by traverse_sequences.

+ +

End of Sequences

+ +

If arrow a reaches the end of its sequence before arrow b does, traverse_sequence will try to call callbacks#finished_a with the last index and element of A (A[-1]) and the current index and element of B (B[j]). If callbacks#finished_a does not exist, then callbacks#discard_b will be called on each element of B until the end of the sequence is reached (the call will be done with A[-1] and B[j] for each element).

+ +

If b reaches the end of B before a reaches the end of A, callbacks#finished_b will be called with the current index and element of A (A[i]) and the last index and element of B (A[-1]). Again, if callbacks#finished_b does not exist on the callback object, then callbacks#discard_a will be called on each element of A until the end of the sequence is reached (A[i] and B[-1]).

+ +

There is a chance that one additional callbacks#discard_a or callbacks#discard_b will be called after the end of the sequence is reached, if a has not yet reached the end of A or b has not yet reached the end of B.

+ +
+
# File lib/diff/lcs.rb, line 285
+def traverse_sequences(seq1, seq2, callbacks = Diff::LCS::SequenceCallbacks) #:yields change events:
+  callbacks ||= Diff::LCS::SequenceCallbacks
+  matches = Diff::LCS::Internals.lcs(seq1, seq2)
+
+  run_finished_a = run_finished_b = false
+  string = seq1.kind_of?(String)
+
+  a_size = seq1.size
+  b_size = seq2.size
+  ai = bj = 0
+
+  matches.each do |b_line|
+    if b_line.nil?
+      unless seq1[ai].nil?
+        ax = string ? seq1[ai, 1] : seq1[ai]
+        bx = string ? seq2[bj, 1] : seq2[bj]
+
+        event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+        event = yield event if block_given?
+        callbacks.discard_a(event)
+      end
+    else
+      ax = string ? seq1[ai, 1] : seq1[ai]
+
+      loop do
+        break unless bj < b_line
+
+        bx = string ? seq2[bj, 1] : seq2[bj]
+        event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+        event = yield event if block_given?
+        callbacks.discard_b(event)
+        bj += 1
+      end
+      bx = string ? seq2[bj, 1] : seq2[bj]
+      event = Diff::LCS::ContextChange.new('=', ai, ax, bj, bx)
+      event = yield event if block_given?
+      callbacks.match(event)
+      bj += 1
+    end
+    ai += 1
+  end
+
+  # The last entry (if any) processed was a match. +ai+ and +bj+ point just
+  # past the last matching lines in their sequences.
+  while (ai < a_size) or (bj < b_size)
+    # last A?
+    if ai == a_size and bj < b_size
+      if callbacks.respond_to?(:finished_a) and !run_finished_a
+        ax = string ? seq1[-1, 1] : seq1[-1]
+        bx = string ? seq2[bj, 1] : seq2[bj]
+        event = Diff::LCS::ContextChange.new('>', (a_size - 1), ax, bj, bx)
+        event = yield event if block_given?
+        callbacks.finished_a(event)
+        run_finished_a = true
+      else
+        ax = string ? seq1[ai, 1] : seq1[ai]
+        loop do
+          bx = string ? seq2[bj, 1] : seq2[bj]
+          event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+          event = yield event if block_given?
+          callbacks.discard_b(event)
+          bj += 1
+          break unless bj < b_size
+        end
+      end
+    end
+
+    # last B?
+    if bj == b_size and ai < a_size
+      if callbacks.respond_to?(:finished_b) and !run_finished_b
+        ax = string ? seq1[ai, 1] : seq1[ai]
+        bx = string ? seq2[-1, 1] : seq2[-1]
+        event = Diff::LCS::ContextChange.new('<', ai, ax, (b_size - 1), bx)
+        event = yield event if block_given?
+        callbacks.finished_b(event)
+        run_finished_b = true
+      else
+        bx = string ? seq2[bj, 1] : seq2[bj]
+        loop do
+          ax = string ? seq1[ai, 1] : seq1[ai]
+          event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+          event = yield event if block_given?
+          callbacks.discard_a(event)
+          ai += 1
+          break unless bj < b_size
+        end
+      end
+    end
+
+    if ai < a_size
+      ax = string ? seq1[ai, 1] : seq1[ai]
+      bx = string ? seq2[bj, 1] : seq2[bj]
+      event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+      event = yield event if block_given?
+      callbacks.discard_a(event)
+      ai += 1
+    end
+
+    if bj < b_size
+      ax = string ? seq1[ai, 1] : seq1[ai]
+      bx = string ? seq2[bj, 1] : seq2[bj]
+      event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+      event = yield event if block_given?
+      callbacks.discard_b(event)
+      bj += 1
+    end
+  end
+end
+
+
+ + +
+ +
+
+ unpatch!(src, patchset) + click to toggle source +
+ +
+

Given a set of patchset, convert the current version to the prior version. Does no auto-discovery.

+ +
+
# File lib/diff/lcs.rb, line 728
+def unpatch!(src, patchset)
+  patch(src, patchset, :unpatch)
+end
+
+
+ + +
+ +
+ +
+
+

Public Instance Methods

+
+ +
+
+ diff(other, callbacks = nil, &block) + click to toggle source +
+ +
+

Returns the difference set between self and other. See Diff::LCS#diff.

+ +
+
# File lib/diff/lcs.rb, line 75
+def diff(other, callbacks = nil, &block)
+  Diff::LCS.diff(self, other, callbacks, &block)
+end
+
+
+ + +
+ +
+
+ lcs(other, &block) + click to toggle source +
+ +
+

Returns an Array containing the longest common subsequence(s) between self and other. See Diff::LCS#lcs.

+ +
lcs = seq1.lcs(seq2)
+
+ +

A note when using objects: Diff::LCS only works properly when each object can be used as a key in a Hash, which typically means that the objects must implement Object#eql? in a way that two identical values compare identically for key purposes. That is:

+ +
O.new('a').eql?(O.new('a')) == true
+
+ +
+
# File lib/diff/lcs.rb, line 70
+def lcs(other, &block) #:yields self[i] if there are matched subsequences:
+  Diff::LCS.lcs(self, other, &block)
+end
+
+
+ + +
+ +
+
+ patch(patchset) + click to toggle source +
+ +
+

Attempts to patch self with the provided patchset. A new sequence based on self and the patchset will be created. See Diff::LCS#patch. Attempts to autodiscover the direction of the patch.

+ +
+
# File lib/diff/lcs.rb, line 101
+def patch(patchset)
+  Diff::LCS.patch(self, patchset)
+end
+
+
+ +
+ Also aliased as: unpatch +
+ +
+ +
+
+ patch!(patchset) + click to toggle source +
+ +
+

Attempts to patch self with the provided patchset. A new sequence based on self and the patchset will be created. See Diff::LCS#patch. Does no patch direction autodiscovery.

+ +
+
# File lib/diff/lcs.rb, line 109
+def patch!(patchset)
+  Diff::LCS.patch!(self, patchset)
+end
+
+
+ + +
+ +
+
+ patch_me(patchset) + click to toggle source +
+ +
+

Attempts to patch self with the provided patchset, using patch!. If the sequence this is used on supports replace, the value of self will be replaced. See Diff::LCS#patch. Does no patch direction autodiscovery.

+ +
+
# File lib/diff/lcs.rb, line 123
+def patch_me(patchset)
+  if respond_to? :replace
+    replace(patch!(patchset))
+  else
+    patch!(patchset)
+  end
+end
+
+
+ + +
+ +
+
+ sdiff(other, callbacks = nil, &block) + click to toggle source +
+ +
+

Returns the balanced (“side-by-side”) difference set between self and other. See Diff::LCS#sdiff.

+ +
+
# File lib/diff/lcs.rb, line 81
+def sdiff(other, callbacks = nil, &block)
+  Diff::LCS.sdiff(self, other, callbacks, &block)
+end
+
+
+ + +
+ +
+
+ traverse_balanced(other, callbacks = nil, &block) + click to toggle source +
+ +
+

Traverses the discovered longest common subsequences between self and other using the alternate, balanced algorithm. See Diff::LCS#traverse_balanced.

+ +
+
# File lib/diff/lcs.rb, line 94
+def traverse_balanced(other, callbacks = nil, &block)
+  Diff::LCS.traverse_balanced(self, other, callbacks || Diff::LCS::BalancedCallbacks, &block)
+end
+
+
+ + +
+ +
+
+ traverse_sequences(other, callbacks = nil, &block) + click to toggle source +
+ +
+

Traverses the discovered longest common subsequences between self and other. See Diff::LCS#traverse_sequences.

+ +
+
# File lib/diff/lcs.rb, line 87
+def traverse_sequences(other, callbacks = nil, &block)
+  Diff::LCS.traverse_sequences(self, other, callbacks || Diff::LCS::SequenceCallbacks, &block)
+end
+
+
+ + +
+ +
+
+ unpatch(patchset) +
+ +
+ + +
+ + +
+ Alias for: patch +
+
+ +
+
+ unpatch!(patchset) + click to toggle source +
+ +
+

Attempts to unpatch self with the provided patchset. A new sequence based on self and the patchset will be created. See Diff::LCS#unpatch. Does no patch direction autodiscovery.

+ +
+
# File lib/diff/lcs.rb, line 116
+def unpatch!(patchset)
+  Diff::LCS.unpatch!(self, patchset)
+end
+
+
+ + +
+ +
+
+ unpatch_me(patchset) + click to toggle source +
+ +
+

Attempts to unpatch self with the provided patchset, using unpatch!. If the sequence this is used on supports replace, the value of self will be replaced. See Diff::LCS#unpatch. Does no patch direction autodiscovery.

+ +
+
# File lib/diff/lcs.rb, line 134
+def unpatch_me(patchset)
+  if respond_to? :replace
+    replace(unpatch!(patchset))
+  else
+    unpatch!(patchset)
+  end
+end
+
+
+ + +
+ +
+ +
+
+ + + + diff --git a/LCS/Block.html b/LCS/Block.html new file mode 100644 index 0000000..b786ef6 --- /dev/null +++ b/LCS/Block.html @@ -0,0 +1,240 @@ + + + + + + +class LCS::Block - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class LCS::Block +

+ +
+ +

A block is an operation removing, adding, or changing a group of items. Basically, this is just a list of changes, where each change adds or deletes a single item. Used by bin/ldiff.

+ +
+ +
+ + + +
+
+

Attributes

+
+ +
+
+ changes[R] +
+ +
+ +
+
+
+
+ insert[R] +
+ +
+ +
+
+
+
+ remove[R] +
+ +
+ +
+
+
+ + +
+
+

Public Class Methods

+
+ +
+
+ new(chunk) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/block.rb, line 9
+def initialize(chunk)
+  @changes = []
+  @insert = []
+  @remove = []
+
+  chunk.each do |item|
+    @changes << item
+    @remove << item if item.deleting?
+    @insert << item if item.adding?
+  end
+end
+
+
+ + +
+ +
+ +
+
+

Public Instance Methods

+
+ +
+
+ diff_size() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/block.rb, line 21
+def diff_size
+  @insert.size - @remove.size
+end
+
+
+ + +
+ +
+
+ op() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/block.rb, line 25
+def op
+  case [@remove.empty?, @insert.empty?]
+  when [false, false]
+    '!'
+  when [false, true]
+    '-'
+  when [true, false]
+    '+'
+  else # [true, true]
+    '^'
+  end
+end
+
+
+ + +
+ +
+ +
+
+ + + + diff --git a/LCS/Change.html b/LCS/Change.html new file mode 100644 index 0000000..c714eea --- /dev/null +++ b/LCS/Change.html @@ -0,0 +1,500 @@ + + + + + + +class LCS::Change - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class LCS::Change +

+ +
+ +

Represents a simplistic (non-contextual) change. Represents the removal or addition of an element from either the old or the new sequenced enumerable.

+ +
+ +
+ + +
+
+

Constants

+
+
+
IntClass +
+
VALID_ACTIONS +

The only actions valid for changes are '+' (add), '-' (delete), '=' (no change), '!' (changed), '<' (tail changes from first sequence), or '>' (tail changes from second sequence). The last two ('<>') are only found with Diff::LCS::diff and Diff::LCS::sdiff.

+
+
+ +
+
+

Attributes

+
+ +
+
+ action[R] +
+ +
+

Returns the action this Change represents.

+
+
+
+
+ element[R] +
+ +
+

Returns the sequence element of the Change.

+
+
+
+
+ position[R] +
+ +
+

Returns the position of the Change.

+
+
+
+ + +
+
+

Public Class Methods

+
+ +
+
+ from_a(arr) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 44
+def self.from_a(arr)
+  arr = arr.flatten(1)
+  case arr.size
+  when 5
+    Diff::LCS::ContextChange.new(*(arr[0...5]))
+  when 3
+    Diff::LCS::Change.new(*(arr[0...3]))
+  else
+    fail 'Invalid change array format provided.'
+  end
+end
+
+
+ + +
+ +
+
+ new(*args) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 27
+def initialize(*args)
+  @action, @position, @element = *args
+
+  fail "Invalid Change Action '#{@action}'" unless Diff::LCS::Change.valid_action?(@action)
+  fail 'Invalid Position Type' unless @position.kind_of? IntClass
+end
+
+
+ + +
+ +
+
+ valid_action?(action) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 15
+def self.valid_action?(action)
+  VALID_ACTIONS.include? action
+end
+
+
+ + +
+ +
+ +
+
+

Public Instance Methods

+
+ +
+
+ <=>(other) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 65
+def <=>(other)
+  r = action <=> other.action
+  r = position <=> other.position if r.zero?
+  r = element <=> other.element if r.zero?
+  r
+end
+
+
+ + +
+ +
+
+ ==(other) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 58
+def ==(other)
+  (self.class == other.class) and
+    (action == other.action) and
+    (position == other.position) and
+    (element == other.element)
+end
+
+
+ + +
+ +
+
+ adding?() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 72
+def adding?
+  @action == '+'
+end
+
+
+ + +
+ +
+
+ changed?() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 84
+def changed?
+  @action == '!'
+end
+
+
+ + +
+ +
+
+ deleting?() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 76
+def deleting?
+  @action == '-'
+end
+
+
+ + +
+ +
+
+ finished_a?() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 88
+def finished_a?
+  @action == '>'
+end
+
+
+ + +
+ +
+
+ finished_b?() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 92
+def finished_b?
+  @action == '<'
+end
+
+
+ + +
+ +
+
+ inspect(*_args) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 34
+def inspect(*_args)
+  "#<#{self.class}: #{to_a.inspect}>"
+end
+
+
+ + +
+ +
+
+ to_a() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 38
+def to_a
+  [@action, @position, @element]
+end
+
+
+ +
+ Also aliased as: to_ary +
+ +
+ +
+
+ to_ary() +
+ +
+ + +
+ + +
+ Alias for: to_a +
+
+ +
+
+ unchanged?() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 80
+def unchanged?
+  @action == '='
+end
+
+
+ + +
+ +
+ +
+
+ + + + diff --git a/LCS/ContextChange.html b/LCS/ContextChange.html new file mode 100644 index 0000000..b9b279c --- /dev/null +++ b/LCS/ContextChange.html @@ -0,0 +1,353 @@ + + + + + + +class LCS::ContextChange - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class LCS::ContextChange +

+ +
+ +

Represents a contextual change. Contains the position and values of the elements in the old and the new sequenced enumerables as well as the action taken.

+ +
+ +
+ + + +
+
+

Attributes

+
+ +
+
+ new_element[R] +
+ +
+

Returns the new element being changed.

+
+
+
+
+ new_position[R] +
+ +
+

Returns the new position being changed.

+
+
+
+
+ old_element[R] +
+ +
+

Returns the old element being changed.

+
+
+
+
+ old_position[R] +
+ +
+

Returns the old position being changed.

+
+
+
+ + +
+
+

Public Class Methods

+
+ +
+
+ from_a(arr) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 132
+def self.from_a(arr)
+  Diff::LCS::Change.from_a(arr)
+end
+
+
+ + +
+ +
+
+ new(*args) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 114
+def initialize(*args)
+  @action, @old_position, @old_element, @new_position, @new_element = *args
+
+  fail "Invalid Change Action '#{@action}'" unless Diff::LCS::Change.valid_action?(@action)
+  fail 'Invalid (Old) Position Type' unless @old_position.nil? or @old_position.kind_of? IntClass
+  fail 'Invalid (New) Position Type' unless @new_position.nil? or @new_position.kind_of? IntClass
+end
+
+
+ + +
+ +
+
+ simplify(event) + click to toggle source +
+ +
+

Simplifies a context change for use in some diff callbacks. '<' actions are converted to '-' and '>' actions are converted to '+'.

+ +
+
# File lib/diff/lcs/change.rb, line 138
+def self.simplify(event)
+  ea = event.to_a
+
+  case ea[0]
+  when '-'
+    ea[2][1] = nil
+  when '<'
+    ea[0] = '-'
+    ea[2][1] = nil
+  when '+'
+    ea[1][1] = nil
+  when '>'
+    ea[0] = '+'
+    ea[1][1] = nil
+  end
+
+  Diff::LCS::ContextChange.from_a(ea)
+end
+
+
+ + +
+ +
+ +
+
+

Public Instance Methods

+
+ +
+
+ <=>(other) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 166
+def <=>(other)
+  r = @action <=> other.action
+  r = @old_position <=> other.old_position if r.zero?
+  r = @new_position <=> other.new_position if r.zero?
+  r = @old_element <=> other.old_element if r.zero?
+  r = @new_element <=> other.new_element if r.zero?
+  r
+end
+
+
+ + +
+ +
+
+ ==(other) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 157
+def ==(other)
+  (self.class == other.class) and
+    (@action == other.action) and
+    (@old_position == other.old_position) and
+    (@new_position == other.new_position) and
+    (@old_element == other.old_element) and
+    (@new_element == other.new_element)
+end
+
+
+ + +
+ +
+
+ to_a() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/change.rb, line 122
+def to_a
+  [
+    @action,
+    [@old_position, @old_element],
+    [@new_position, @new_element]
+  ]
+end
+
+
+ +
+ Also aliased as: to_ary +
+ +
+ +
+
+ to_ary() +
+ +
+ + +
+ + +
+ Alias for: to_a +
+
+ +
+ +
+
+ + + + diff --git a/LCS/ContextDiffCallbacks.html b/LCS/ContextDiffCallbacks.html new file mode 100644 index 0000000..2a1345b --- /dev/null +++ b/LCS/ContextDiffCallbacks.html @@ -0,0 +1,255 @@ + + + + + + +class LCS::ContextDiffCallbacks - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class LCS::ContextDiffCallbacks +

+ +
+ +

This will produce a compound array of contextual diff change objects. Each element in the diffs array is a “hunk” array, where each element in each “hunk” array is a single change. Each change is a Diff::LCS::ContextChange that contains both the old index and new index values for the change. The “hunk” provides the full context for the changes. Both old and new objects will be presented for changed objects. nil will be substituted for a discarded object.

+ +
seq1 = %w(a b c e h j l m n p)
+seq2 = %w(b c d e f j k l m r s t)
+
+diffs = Diff::LCS.diff(seq1, seq2, Diff::LCS::ContextDiffCallbacks)
+  # This example shows a simplified array format.
+  # [ [ [ '-', [  0, 'a' ], [  0, nil ] ] ],   # 1
+  #   [ [ '+', [  3, nil ], [  2, 'd' ] ] ],   # 2
+  #   [ [ '-', [  4, 'h' ], [  4, nil ] ],     # 3
+  #     [ '+', [  5, nil ], [  4, 'f' ] ] ],
+  #   [ [ '+', [  6, nil ], [  6, 'k' ] ] ],   # 4
+  #   [ [ '-', [  8, 'n' ], [  9, nil ] ],     # 5
+  #     [ '+', [  9, nil ], [  9, 'r' ] ],
+  #     [ '-', [  9, 'p' ], [ 10, nil ] ],
+  #     [ '+', [ 10, nil ], [ 10, 's' ] ],
+  #     [ '+', [ 10, nil ], [ 11, 't' ] ] ] ]
+
+ +

The five hunks shown are comprised of individual changes; if there is a related set of changes, they are still shown individually.

+ +

This callback can also be used with Diff::LCS#sdiff, which will produce results like:

+ +
diffs = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextCallbacks)
+  # This example shows a simplified array format.
+  # [ [ [ "-", [  0, "a" ], [  0, nil ] ] ],  # 1
+  #   [ [ "+", [  3, nil ], [  2, "d" ] ] ],  # 2
+  #   [ [ "!", [  4, "h" ], [  4, "f" ] ] ],  # 3
+  #   [ [ "+", [  6, nil ], [  6, "k" ] ] ],  # 4
+  #   [ [ "!", [  8, "n" ], [  9, "r" ] ],    # 5
+  #     [ "!", [  9, "p" ], [ 10, "s" ] ],
+  #     [ "+", [ 10, nil ], [ 11, "t" ] ] ] ]
+
+ +

The five hunks are still present, but are significantly shorter in total presentation, because changed items are shown as changes (“!”) instead of potentially “mismatched” pairs of additions and deletions.

+ +

The result of this operation is similar to that of Diff::LCS::SDiffCallbacks. They may be compared as:

+ +
s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
+c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
+
+s == c # -> true
+
+ +

Use

+ +

This callback object must be initialised and can be used by the Diff::LCS#diff or Diff::LCS#sdiff methods.

+ +
cbo = Diff::LCS::ContextDiffCallbacks.new
+Diff::LCS.LCS(seq1, seq2, cbo)
+cbo.finish
+
+ +

Note that the call to finish is absolutely necessary, or the last set of changes will not be visible. Alternatively, can be used as:

+ +
cbo = Diff::LCS::ContextDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
+
+ +

The necessary finish call will be made.

+ +

Simplified Array Format

+ +

The simplified array format used in the example above can be obtained with:

+ +
require 'pp'
+pp diffs.map { |e| e.map { |f| f.to_a } }
+
+ +
+ +
+ + + + + +
+
+

Public Instance Methods

+
+ +
+
+ change(event) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 232
+def change(event)
+  @hunk << Diff::LCS::ContextChange.simplify(event)
+end
+
+
+ + +
+ +
+
+ discard_a(event) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 224
+def discard_a(event)
+  @hunk << Diff::LCS::ContextChange.simplify(event)
+end
+
+
+ + +
+ +
+
+ discard_b(event) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 228
+def discard_b(event)
+  @hunk << Diff::LCS::ContextChange.simplify(event)
+end
+
+
+ + +
+ +
+ +
+
+ + + + diff --git a/LCS/DefaultCallbacks.html b/LCS/DefaultCallbacks.html new file mode 100644 index 0000000..a63bb94 --- /dev/null +++ b/LCS/DefaultCallbacks.html @@ -0,0 +1,207 @@ + + + + + + +class LCS::SequenceCallbacks - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class LCS::SequenceCallbacks +

+ +
+ +

This callback object implements the default set of callback events, which only returns the event itself. Note that finished_a and finished_b are not implemented – I haven't yet figured out where they would be useful.

+ +

Note that this is intended to be called as is, e.g.,

+ +
Diff::LCS.LCS(seq1, seq2, Diff::LCS::DefaultCallbacks)
+
+ +
+ +
+ + + + + +
+
+

Public Class Methods

+
+ +
+
+ change(event) + click to toggle source +
+ +
+

Called when both the old and new values have changed.

+ +
+
# File lib/diff/lcs/callbacks.rb, line 32
+def change(event)
+  event
+end
+
+
+ + +
+ +
+
+ discard_a(event) + click to toggle source +
+ +
+

Called when the old value is discarded in favour of the new value.

+ +
+
# File lib/diff/lcs/callbacks.rb, line 22
+def discard_a(event)
+  event
+end
+
+
+ + +
+ +
+
+ discard_b(event) + click to toggle source +
+ +
+

Called when the new value is discarded in favour of the old value.

+ +
+
# File lib/diff/lcs/callbacks.rb, line 27
+def discard_b(event)
+  event
+end
+
+
+ + +
+ +
+
+ match(event) + click to toggle source +
+ +
+

Called when two items match.

+ +
+
# File lib/diff/lcs/callbacks.rb, line 17
+def match(event)
+  event
+end
+
+
+ + +
+ +
+ +
+
+ + + + diff --git a/LCS/DiffCallbacks.html b/LCS/DiffCallbacks.html new file mode 100644 index 0000000..d82b399 --- /dev/null +++ b/LCS/DiffCallbacks.html @@ -0,0 +1,305 @@ + + + + + + +class LCS::DiffCallbacks - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class LCS::DiffCallbacks +

+ +
+ +

This will produce a compound array of simple diff change objects. Each element in the diffs array is a hunk or hunk array, where each element in each hunk array is a single Change object representing the addition or removal of a single element from one of the two tested sequences. The hunk provides the full context for the changes.

+ +
diffs = Diff::LCS.diff(seq1, seq2)
+  # This example shows a simplified array format.
+  # [ [ [ '-',  0, 'a' ] ],   # 1
+  #   [ [ '+',  2, 'd' ] ],   # 2
+  #   [ [ '-',  4, 'h' ],     # 3
+  #     [ '+',  4, 'f' ] ],
+  #   [ [ '+',  6, 'k' ] ],   # 4
+  #   [ [ '-',  8, 'n' ],     # 5
+  #     [ '-',  9, 'p' ],
+  #     [ '+',  9, 'r' ],
+  #     [ '+', 10, 's' ],
+  #     [ '+', 11, 't' ] ] ]
+
+ +

There are five hunks here. The first hunk says that the a at position 0 of the first sequence should be deleted ('-'). The second hunk says that the d at position 2 of the second sequence should be inserted ('+'). The third hunk says that the h at position 4 of the first sequence should be removed and replaced with the f from position 4 of the second sequence. The other two hunks are described similarly.

+ +

Use

+ +

This callback object must be initialised and is used by the Diff::LCS#diff method.

+ +
cbo = Diff::LCS::DiffCallbacks.new
+Diff::LCS.LCS(seq1, seq2, cbo)
+cbo.finish
+
+ +

Note that the call to finish is absolutely necessary, or the last set of changes will not be visible. Alternatively, can be used as:

+ +
cbo = Diff::LCS::DiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
+
+ +

The necessary finish call will be made.

+ +

Simplified Array Format

+ +

The simplified array format used in the example above can be obtained with:

+ +
require 'pp'
+pp diffs.map { |e| e.map { |f| f.to_a } }
+
+ +
+ +
+ + + +
+
+

Attributes

+
+ +
+
+ diffs[R] +
+ +
+

Returns the difference set collected during the diff process.

+
+
+
+ + +
+
+

Public Class Methods

+
+ +
+
+ new() { |self| ... } + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 110
+def initialize # :yields self:
+  @hunk = []
+  @diffs = []
+
+  return unless block_given?
+
+  begin
+    yield self
+  ensure
+    finish
+  end
+end
+
+
+ + +
+ +
+ +
+
+

Public Instance Methods

+
+ +
+
+ discard_a(event) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 133
+def discard_a(event)
+  @hunk << Diff::LCS::Change.new('-', event.old_position, event.old_element)
+end
+
+
+ + +
+ +
+
+ discard_b(event) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 137
+def discard_b(event)
+  @hunk << Diff::LCS::Change.new('+', event.new_position, event.new_element)
+end
+
+
+ + +
+ +
+
+ finish() + click to toggle source +
+ +
+

Finalizes the diff process. If an unprocessed hunk still exists, then it is appended to the diff list.

+ +
+
# File lib/diff/lcs/callbacks.rb, line 125
+def finish
+  finish_hunk
+end
+
+
+ + +
+ +
+
+ match(_event) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 129
+def match(_event)
+  finish_hunk
+end
+
+
+ + +
+ +
+ +
+
+ + + + diff --git a/LCS/HTMLDiff.html b/LCS/HTMLDiff.html new file mode 100644 index 0000000..19314fc --- /dev/null +++ b/LCS/HTMLDiff.html @@ -0,0 +1,231 @@ + + + + + + +class LCS::HTMLDiff - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class LCS::HTMLDiff +

+ +
+ +

Produce a simple HTML diff view.

+ +
+ +
+ + +
+
+

Constants

+
+
+
DEFAULT_CSS +
+
DEFAULT_OPTIONS +
+
+
+ +
+
+

Attributes

+
+ +
+
+ options[R] +
+ +
+ +
+
+
+ + +
+
+

Public Class Methods

+
+ +
+
+ new(left, right, options = nil) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/htmldiff.rb, line 90
+def initialize(left, right, options = nil)
+  @left     = left
+  @right    = right
+  @options  = options
+
+  @options = DEFAULT_OPTIONS.dup if @options.nil?
+end
+
+
+ + +
+ +
+ +
+
+

Public Instance Methods

+
+ +
+
+ run() + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/htmldiff.rb, line 112
+  def run
+    verify_options
+
+    if @options[:expand_tabs].positive? && self.class.can_expand_tabs
+      formatter = Text::Format.new
+      formatter.tabstop = @options[:expand_tabs]
+
+      @left.map! do |line| formatter.expand(line.chomp) end
+      @right.map! do |line| formatter.expand(line.chomp) end
+    end
+
+    @left.map! do |line| CGI.escapeHTML(line.chomp) end
+    @right.map! do |line| CGI.escapeHTML(line.chomp) end
+
+    @options[:output] << <<-OUTPUT
+<html>
+  <head>
+    <title>#{@options[:title]}</title>
+    <style type="text/css">
+    #{@options[:css]}
+    </style>
+  </head>
+  <body>
+    <h1>#{@options[:title]}</h1>
+    <p>Legend: <span class="only_a">Only in Old</span>&nbsp;
+    <span class="only_b">Only in New</span></p>
+    <div class="diff">
+    OUTPUT
+
+    callbacks = Callbacks.new(@options[:output])
+    Diff::LCS.traverse_sequences(@left, @right, callbacks)
+
+    @options[:output] << <<-OUTPUT
+    </div>
+  </body>
+</html>
+    OUTPUT
+  end
+
+
+ + +
+ +
+ +
+
+ + + + diff --git a/LCS/Hunk.html b/LCS/Hunk.html new file mode 100644 index 0000000..0a22329 --- /dev/null +++ b/LCS/Hunk.html @@ -0,0 +1,397 @@ + + + + + + +class LCS::Hunk - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class LCS::Hunk +

+ +
+ +

A Hunk is a group of Blocks which overlap because of the context surrounding each block. (So if we're not using context, every hunk will contain one block.) Used in the diff program (bin/ldiff).

+ +
+ +
+ + + +
+
+

Attributes

+
+ +
+
+ blocks[R] +
+ +
+ +
+
+
+
+ end_new[R] +
+ +
+ +
+
+
+
+ end_old[R] +
+ +
+ +
+
+
+
+ file_length_difference[R] +
+ +
+ +
+
+
+
+ flag_context[RW] +
+ +
+

Change the “start” and “end” fields to note that context should be added to this hunk.

+
+
+
+
+ start_new[R] +
+ +
+ +
+
+
+
+ start_old[R] +
+ +
+ +
+
+
+ + +
+
+

Public Class Methods

+
+ +
+
+ new(data_old, data_new, piece, flag_context, file_length_difference) + click to toggle source +
+ +
+

Create a hunk using references to both the old and new data, as well as the piece of data.

+ +
+
# File lib/diff/lcs/hunk.rb, line 16
+def initialize(data_old, data_new, piece, flag_context, file_length_difference)
+  # At first, a hunk will have just one Block in it
+  @blocks = [Diff::LCS::Block.new(piece)]
+
+  if @blocks[0].remove.empty? && @blocks[0].insert.empty?
+    fail "Cannot build a hunk from #{piece.inspect}; has no add or remove actions"
+  end
+
+  if String.method_defined?(:encoding)
+    @preferred_data_encoding = data_old.fetch(0, data_new.fetch(0, '')).encoding
+  end
+
+  @data_old = data_old
+  @data_new = data_new
+
+  before = after = file_length_difference
+  after += @blocks[0].diff_size
+  @file_length_difference = after # The caller must get this manually
+  @max_diff_size = @blocks.map { |e| e.diff_size.abs }.max
+
+
+  # Save the start & end of each array. If the array doesn't exist (e.g.,
+  # we're only adding items in this block), then figure out the line number
+  # based on the line number of the other file and the current difference in
+  # file lengths.
+  if @blocks[0].remove.empty?
+    a1 = a2 = nil
+  else
+    a1 = @blocks[0].remove[0].position
+    a2 = @blocks[0].remove[-1].position
+  end
+
+  if @blocks[0].insert.empty?
+    b1 = b2 = nil
+  else
+    b1 = @blocks[0].insert[0].position
+    b2 = @blocks[0].insert[-1].position
+  end
+
+  @start_old = a1 || (b1 - before)
+  @start_new = b1 || (a1 + before)
+  @end_old   = a2 || (b2 - after)
+  @end_new   = b2 || (a2 + after)
+
+  self.flag_context = flag_context
+end
+
+
+ + +
+ +
+ +
+
+

Public Instance Methods

+
+ +
+
+ diff(format, last = false) + click to toggle source +
+ +
+

Returns a diff string based on a format.

+ +
+
# File lib/diff/lcs/hunk.rb, line 116
+def diff(format, last = false)
+  case format
+  when :old
+    old_diff(last)
+  when :unified
+    unified_diff(last)
+  when :context
+    context_diff(last)
+  when :ed
+    self
+  when :reverse_ed, :ed_finish
+    ed_diff(format, last)
+  else
+    fail "Unknown diff format #{format}."
+  end
+end
+
+
+ + +
+ +
+
+ merge(hunk) + click to toggle source +
+ +
+

Merges this hunk and the provided hunk together if they overlap. Returns a truthy value so that if there is no overlap, you can know the merge was skipped.

+ +
+
# File lib/diff/lcs/hunk.rb, line 98
+def merge(hunk)
+  return unless overlaps?(hunk)
+
+  @start_old = hunk.start_old
+  @start_new = hunk.start_new
+  blocks.unshift(*hunk.blocks)
+end
+
+
+ +
+ Also aliased as: unshift +
+ +
+ +
+
+ missing_last_newline?(data) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/hunk.rb, line 326
+def missing_last_newline?(data)
+  newline = encode("\n")
+
+  if data[-2]
+    data[-2].end_with?(newline) && !data[-1].end_with?(newline)
+  elsif data[-1]
+    !data[-1].end_with?(newline)
+  else
+    true
+  end
+end
+
+
+ + +
+ +
+
+ overlaps?(hunk) + click to toggle source +
+ +
+

Determines whether there is an overlap between this hunk and the provided hunk. This will be true if the difference between the two hunks start or end positions is within one position of each other.

+ +
+
# File lib/diff/lcs/hunk.rb, line 110
+def overlaps?(hunk)
+  hunk and (((@start_old - hunk.end_old) <= 1) or
+            ((@start_new - hunk.end_new) <= 1))
+end
+
+
+ + +
+ +
+
+ unshift(hunk) +
+ +
+ + +
+ + +
+ Alias for: merge +
+
+ +
+ +
+
+ + + + diff --git a/LCS/SDiffCallbacks.html b/LCS/SDiffCallbacks.html new file mode 100644 index 0000000..46b385f --- /dev/null +++ b/LCS/SDiffCallbacks.html @@ -0,0 +1,312 @@ + + + + + + +class LCS::SDiffCallbacks - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class LCS::SDiffCallbacks +

+ +
+ +

This will produce a simple array of diff change objects. Each element in the diffs array is a single ContextChange. In the set of diffs provided by SDiffCallbacks, both old and new objects will be presented for both changed <strong>and unchanged</strong> objects. nil will be substituted for a discarded object.

+ +

The diffset produced by this callback, when provided to Diff::LCS#sdiff, will compute and display the necessary components to show two sequences and their minimized differences side by side, just like the Unix utility sdiff.

+ +
same             same
+before     |     after
+old        <     -
+-          >     new
+
+seq1 = %w(a b c e h j l m n p)
+seq2 = %w(b c d e f j k l m r s t)
+
+diffs = Diff::LCS.sdiff(seq1, seq2)
+  # This example shows a simplified array format.
+  # [ [ "-", [  0, "a"], [  0, nil ] ],
+  #   [ "=", [  1, "b"], [  0, "b" ] ],
+  #   [ "=", [  2, "c"], [  1, "c" ] ],
+  #   [ "+", [  3, nil], [  2, "d" ] ],
+  #   [ "=", [  3, "e"], [  3, "e" ] ],
+  #   [ "!", [  4, "h"], [  4, "f" ] ],
+  #   [ "=", [  5, "j"], [  5, "j" ] ],
+  #   [ "+", [  6, nil], [  6, "k" ] ],
+  #   [ "=", [  6, "l"], [  7, "l" ] ],
+  #   [ "=", [  7, "m"], [  8, "m" ] ],
+  #   [ "!", [  8, "n"], [  9, "r" ] ],
+  #   [ "!", [  9, "p"], [ 10, "s" ] ],
+  #   [ "+", [ 10, nil], [ 11, "t" ] ] ]
+ +

The result of this operation is similar to that of Diff::LCS::ContextDiffCallbacks. They may be compared as:

+ +
s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
+c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
+
+s == c # -> true
+
+ +

Use

+ +

This callback object must be initialised and is used by the Diff::LCS#sdiff method.

+ +
cbo = Diff::LCS::SDiffCallbacks.new
+Diff::LCS.LCS(seq1, seq2, cbo)
+
+ +

As with the other initialisable callback objects, Diff::LCS::SDiffCallbacks can be initialised with a block. As there is no “fininishing” to be done, this has no effect on the state of the object.

+ +
cbo = Diff::LCS::SDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
+
+ +

Simplified Array Format

+ +

The simplified array format used in the example above can be obtained with:

+ +
require 'pp'
+pp diffs.map { |e| e.to_a }
+
+ +
+ +
+ + + +
+
+

Attributes

+
+ +
+
+ diffs[R] +
+ +
+

Returns the difference set collected during the diff process.

+
+
+
+ + +
+
+

Public Class Methods

+
+ +
+
+ new() { |self| ... } + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 305
+def initialize #:yields self:
+  @diffs = []
+  yield self if block_given?
+end
+
+
+ + +
+ +
+ +
+
+

Public Instance Methods

+
+ +
+
+ change(event) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 322
+def change(event)
+  @diffs << Diff::LCS::ContextChange.simplify(event)
+end
+
+
+ + +
+ +
+
+ discard_a(event) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 314
+def discard_a(event)
+  @diffs << Diff::LCS::ContextChange.simplify(event)
+end
+
+
+ + +
+ +
+
+ discard_b(event) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 318
+def discard_b(event)
+  @diffs << Diff::LCS::ContextChange.simplify(event)
+end
+
+
+ + +
+ +
+
+ match(event) + click to toggle source +
+ +
+ + +
+
# File lib/diff/lcs/callbacks.rb, line 310
+def match(event)
+  @diffs << Diff::LCS::ContextChange.simplify(event)
+end
+
+
+ + +
+ +
+ +
+
+ + + + diff --git a/License_md.html b/License_md.html new file mode 100644 index 0000000..c0fd8e4 --- /dev/null +++ b/License_md.html @@ -0,0 +1,110 @@ + + + + + + +License - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+ +

== License

+ +

This software is available under three licenses: the GNU GPL version 2 (or at your option, a later version), the Perl Artistic license, or the MIT license. Note that my preference for licensing is the MIT license, but Algorithm::Diff was dually originally licensed with the Perl Artistic and the GNU GPL (“the same terms as Perl itself”) and given that the Ruby implementation originally hewed pretty closely to the Perl version, I must maintain the additional licensing terms.

+ + +

=== MIT License

+ +

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

+ +

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

+ +

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ +

=== Perl Artistic License (version 2) See the file docs/artistic.txt in the main distribution.

+ +

=== GNU GPL version 2 See the file docs/COPYING.txt in the main distribution.

+ +
+ + + + + diff --git a/Manifest_txt.html b/Manifest_txt.html new file mode 100644 index 0000000..4f36eee --- /dev/null +++ b/Manifest_txt.html @@ -0,0 +1,91 @@ + + + + + + +Manifest - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+ +

.rspec Code-of-Conduct.md Contributing.md History.md License.md Manifest.txt README.rdoc Rakefile bin/htmldiff bin/ldiff docs/COPYING.txt docs/artistic.txt lib/diff-lcs.rb lib/diff/lcs.rb lib/diff/lcs/array.rb lib/diff/lcs/backports.rb lib/diff/lcs/block.rb lib/diff/lcs/callbacks.rb lib/diff/lcs/change.rb lib/diff/lcs/htmldiff.rb lib/diff/lcs/hunk.rb lib/diff/lcs/internals.rb lib/diff/lcs/ldiff.rb lib/diff/lcs/string.rb spec/change_spec.rb spec/diff_spec.rb spec/fixtures/aX spec/fixtures/bXaX spec/fixtures/ds1.csv spec/fixtures/ds2.csv spec/fixtures/ldiff/output.diff spec/fixtures/ldiff/output.diff-c spec/fixtures/ldiff/output.diff-e spec/fixtures/ldiff/output.diff-f spec/fixtures/ldiff/output.diff-u spec/fixtures/ldiff/output.diff.chef spec/fixtures/ldiff/output.diff.chef-c spec/fixtures/ldiff/output.diff.chef-e spec/fixtures/ldiff/output.diff.chef-f spec/fixtures/ldiff/output.diff.chef-u spec/fixtures/ldiff/output.diff.chef2 spec/fixtures/ldiff/output.diff.chef2-c spec/fixtures/ldiff/output.diff.chef2-d spec/fixtures/ldiff/output.diff.chef2-e spec/fixtures/ldiff/output.diff.chef2-f spec/fixtures/ldiff/output.diff.chef2-u spec/fixtures/new-chef spec/fixtures/new-chef2 spec/fixtures/old-chef spec/fixtures/old-chef2 spec/hunk_spec.rb spec/issues_spec.rb spec/lcs_spec.rb spec/ldiff_spec.rb spec/patch_spec.rb spec/sdiff_spec.rb spec/spec_helper.rb spec/traverse_balanced_spec.rb spec/traverse_sequences_spec.rb

+ +
+ + + + + diff --git a/README_rdoc.html b/README_rdoc.html new file mode 100644 index 0000000..8b2478e --- /dev/null +++ b/README_rdoc.html @@ -0,0 +1,170 @@ + + + + + + +README - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+ +

Diff::LCS

+
home +
+

github.com/halostatue/diff-lcs

+
code +
+

github.com/halostatue/diff-lcs

+
bugs +
+

github.com/halostatue/diff-lcs/issues

+
rdoc +
+

rubydoc.info/github/halostatue/diff-lcs

+
continuous integration +
+

+
+ +

Description

+ +

Diff::LCS computes the difference between two Enumerable sequences using the McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities to create a simple HTML diff output format and a standard diff-like tool.

+ +

This is release 1.4.3, providing a simple extension that allows for Diff::LCS::Change objects to be treated implicitly as arrays and fixes a number of formatting issues.

+ +

Ruby versions below 2.5 are soft-deprecated, which means that older versions are no longer part of the CI test suite. If any changes have been introduced that break those versions, bug reports and patches will be accepted, but it will be up to the reporter to verify any fixes prior to release. The next major release will completely break compatibility.

+ +

Synopsis

+ +

Using this module is quite simple. By default, Diff::LCS does not extend objects with the Diff::LCS interface, but will be called as if it were a function:

+ +
require 'diff/lcs'
+
+seq1 = %w(a b c e h j l m n p)
+seq2 = %w(b c d e f j k l m r s t)
+
+lcs = Diff::LCS.LCS(seq1, seq2)
+diffs = Diff::LCS.diff(seq1, seq2)
+sdiff = Diff::LCS.sdiff(seq1, seq2)
+seq = Diff::LCS.traverse_sequences(seq1, seq2, callback_obj)
+bal = Diff::LCS.traverse_balanced(seq1, seq2, callback_obj)
+seq2 == Diff::LCS.patch!(seq1, diffs)
+seq1 == Diff::LCS.unpatch!(seq2, diffs)
+seq2 == Diff::LCS.patch!(seq1, sdiff)
+seq1 == Diff::LCS.unpatch!(seq2, sdiff)
+
+ +

Objects can be extended with Diff::LCS:

+ +
seq1.extend(Diff::LCS)
+lcs = seq1.lcs(seq2)
+diffs = seq1.diff(seq2)
+sdiff = seq1.sdiff(seq2)
+seq = seq1.traverse_sequences(seq2, callback_obj)
+bal = seq1.traverse_balanced(seq2, callback_obj)
+seq2 == seq1.patch!(diffs)
+seq1 == seq2.unpatch!(diffs)
+seq2 == seq1.patch!(sdiff)
+seq1 == seq2.unpatch!(sdiff)
+
+ +

By requiring 'diff/lcs/array' or 'diff/lcs/string', Array or String will be extended for use this way.

+ +

Note that Diff::LCS requires a sequenced enumerable container, which means that the order of enumeration is both predictable and consistent for the same set of data. While it is theoretically possible to generate a diff for an unordered hash, it will only be meaningful if the enumeration of the hashes is consistent. In general, this will mean that containers that behave like String or Array will perform best.

+ +

History

+ +

Diff::LCS is a port of Perl's Algorithm::Diff that uses the McIlroy-Hunt longest common subsequence (LCS) algorithm to compute intelligent differences between two sequenced enumerable containers. The implementation is based on Mario I. Wolczko's Smalltalk version 1.2 (1993) and Ned Konz's Perl version Algorithm::Diff 1.15. Diff::LCS#sdiff and Diff::LCS#traverse_balanced were originally written for the Perl version by Mike Schilli.

+ +

The algorithm is described in A Fast Algorithm for Computing Longest Common Subsequences, CACM, vol.20, no.5, pp.350-353, May 1977, with a few minor improvements to improve the speed. A simplified description of the algorithm, originally written for the Perl version, was written by Mark-Jason Dominus.

+ +
+ + + + + diff --git a/String.html b/String.html new file mode 100644 index 0000000..18d26b9 --- /dev/null +++ b/String.html @@ -0,0 +1,105 @@ + + + + + + +class String - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+

+ class String +

+ +
+ +
+ +
+ + + + + +
+
+ + + + diff --git a/artistic_txt.html b/artistic_txt.html new file mode 100644 index 0000000..9410972 --- /dev/null +++ b/artistic_txt.html @@ -0,0 +1,204 @@ + + + + + + +artistic - diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+ +

The “Artistic License”

+ +
Preamble
+
+ +

The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications.

+ +

Definitions:

+ +
"Package" refers to the collection of files distributed by the
+Copyright Holder, and derivatives of that collection of files
+created through textual modification.
+
+"Standard Version" refers to such a Package if it has not been
+modified, or has been modified in accordance with the wishes
+of the Copyright Holder as specified below.
+
+"Copyright Holder" is whoever is named in the copyright or
+copyrights for the package.
+
+"You" is you, if you're thinking about copying or distributing
+this Package.
+
+"Reasonable copying fee" is whatever you can justify on the
+basis of media cost, duplication charges, time of people involved,
+and so on.  (You will not be required to justify it to the
+Copyright Holder, but only to the computing community at large
+as a market that must bear the fee.)
+
+"Freely Available" means that no fee is charged for the item
+itself, though there may be fees involved in handling the item.
+It also means that recipients of the item may redistribute it
+under the same conditions they received it.
+
  1. +

    You may make and give away verbatim copies of the source form of the

    +
+ +

Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers.

+
  1. +

    You may apply bug fixes, portability fixes and other modifications

    +
+ +

derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version.

+
  1. +

    You may otherwise modify your copy of this Package in any way, provided

    +
+ +

that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following:

+ +
a) place your modifications in the Public Domain or otherwise make them
+Freely Available, such as by posting said modifications to Usenet or
+an equivalent medium, or placing the modifications on a major archive
+site such as uunet.uu.net, or by allowing the Copyright Holder to include
+your modifications in the Standard Version of the Package.
+
+b) use the modified Package only within your corporation or organization.
+
+c) rename any non-standard executables so the names do not conflict
+with standard executables, which must also be provided, and provide
+a separate manual page for each non-standard executable that clearly
+documents how it differs from the Standard Version.
+
+d) make other distribution arrangements with the Copyright Holder.
+
  1. +

    You may distribute the programs of this Package in object code or

    +
+ +

executable form, provided that you do at least ONE of the following:

+ +
a) distribute a Standard Version of the executables and library files,
+together with instructions (in the manual page or equivalent) on where
+to get the Standard Version.
+
+b) accompany the distribution with the machine-readable source of
+the Package with your modifications.
+
+c) give non-standard executables non-standard names, and clearly
+document the differences in manual pages (or equivalent), together
+with instructions on where to get the Standard Version.
+
+d) make other distribution arrangements with the Copyright Holder.
+
  1. +

    You may charge a reasonable copying fee for any distribution of this

    +
+ +

Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded.

+
  1. +

    The scripts and library files supplied as input to or produced as

    +
+ +

output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called “undump” or “unexec” methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package.

+
  1. +

    C subroutines (or comparably compiled subroutines in other

    +
+ +

languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language.

+
  1. +

    Aggregation of this Package with a commercial distribution is always

    +
+ +

permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package.

+
  1. +

    The name of the Copyright Holder may not be used to endorse or promote

    +
+ +

products derived from this software without specific prior written permission.

+
  1. +

    THIS PACKAGE IS PROVIDED “AS IS” AND WITHOUT ANY EXPRESS OR

    +
+ +

IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

+ +
The End
+
+ +
+ + + + + diff --git a/created.rid b/created.rid new file mode 100644 index 0000000..6ca4fff --- /dev/null +++ b/created.rid @@ -0,0 +1,21 @@ +Thu, 23 Dec 2021 00:51:29 -0500 +lib/diff/lcs/ldiff.rb Thu, 23 Dec 2021 00:51:24 -0500 +lib/diff/lcs/change.rb Thu, 23 Dec 2021 00:51:24 -0500 +lib/diff/lcs/string.rb Thu, 23 Dec 2021 00:51:24 -0500 +lib/diff/lcs/block.rb Thu, 23 Dec 2021 00:51:24 -0500 +lib/diff/lcs/array.rb Thu, 23 Dec 2021 00:51:24 -0500 +lib/diff/lcs/callbacks.rb Thu, 23 Dec 2021 00:51:24 -0500 +lib/diff/lcs/backports.rb Thu, 23 Dec 2021 00:51:24 -0500 +lib/diff/lcs/hunk.rb Thu, 23 Dec 2021 00:51:24 -0500 +lib/diff/lcs/internals.rb Thu, 23 Dec 2021 00:51:24 -0500 +lib/diff/lcs/htmldiff.rb Thu, 23 Dec 2021 00:51:24 -0500 +lib/diff/lcs.rb Thu, 23 Dec 2021 00:51:24 -0500 +lib/diff-lcs.rb Thu, 23 Dec 2021 00:51:24 -0500 +Code-of-Conduct.md Thu, 23 Dec 2021 00:51:24 -0500 +Contributing.md Thu, 23 Dec 2021 00:51:24 -0500 +History.md Thu, 23 Dec 2021 00:51:24 -0500 +License.md Thu, 23 Dec 2021 00:51:24 -0500 +Manifest.txt Thu, 23 Dec 2021 00:51:24 -0500 +README.rdoc Thu, 23 Dec 2021 00:51:24 -0500 +docs/COPYING.txt Thu, 23 Dec 2021 00:51:24 -0500 +docs/artistic.txt Thu, 23 Dec 2021 00:51:24 -0500 diff --git a/css/fonts.css b/css/fonts.css new file mode 100644 index 0000000..57302b5 --- /dev/null +++ b/css/fonts.css @@ -0,0 +1,167 @@ +/* + * Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + * with Reserved Font Name "Source". All Rights Reserved. Source is a + * trademark of Adobe Systems Incorporated in the United States and/or other + * countries. + * + * This Font Software is licensed under the SIL Open Font License, Version + * 1.1. + * + * This license is copied below, and is also available with a FAQ at: + * http://scripts.sil.org/OFL + */ + +@font-face { + font-family: "Source Code Pro"; + font-style: normal; + font-weight: 400; + src: local("Source Code Pro"), + local("SourceCodePro-Regular"), + url("../fonts/SourceCodePro-Regular.ttf") format("truetype"); +} + +@font-face { + font-family: "Source Code Pro"; + font-style: normal; + font-weight: 700; + src: local("Source Code Pro Bold"), + local("SourceCodePro-Bold"), + url("../fonts/SourceCodePro-Bold.ttf") format("truetype"); +} + +/* + * Copyright (c) 2010, Łukasz Dziedzic (dziedzic@typoland.com), + * with Reserved Font Name Lato. + * + * This Font Software is licensed under the SIL Open Font License, Version + * 1.1. + * + * This license is copied below, and is also available with a FAQ at: + * http://scripts.sil.org/OFL + */ + +@font-face { + font-family: "Lato"; + font-style: normal; + font-weight: 300; + src: local("Lato Light"), + local("Lato-Light"), + url("../fonts/Lato-Light.ttf") format("truetype"); +} + +@font-face { + font-family: "Lato"; + font-style: italic; + font-weight: 300; + src: local("Lato Light Italic"), + local("Lato-LightItalic"), + url("../fonts/Lato-LightItalic.ttf") format("truetype"); +} + +@font-face { + font-family: "Lato"; + font-style: normal; + font-weight: 700; + src: local("Lato Regular"), + local("Lato-Regular"), + url("../fonts/Lato-Regular.ttf") format("truetype"); +} + +@font-face { + font-family: "Lato"; + font-style: italic; + font-weight: 700; + src: local("Lato Italic"), + local("Lato-Italic"), + url("../fonts/Lato-RegularItalic.ttf") format("truetype"); +} + +/* + * ----------------------------------------------------------- + * SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 + * ----------------------------------------------------------- + * + * PREAMBLE + * The goals of the Open Font License (OFL) are to stimulate worldwide + * development of collaborative font projects, to support the font creation + * efforts of academic and linguistic communities, and to provide a free and + * open framework in which fonts may be shared and improved in partnership + * with others. + * + * The OFL allows the licensed fonts to be used, studied, modified and + * redistributed freely as long as they are not sold by themselves. The + * fonts, including any derivative works, can be bundled, embedded, + * redistributed and/or sold with any software provided that any reserved + * names are not used by derivative works. The fonts and derivatives, + * however, cannot be released under any other type of license. The + * requirement for fonts to remain under this license does not apply + * to any document created using the fonts or their derivatives. + * + * DEFINITIONS + * "Font Software" refers to the set of files released by the Copyright + * Holder(s) under this license and clearly marked as such. This may + * include source files, build scripts and documentation. + * + * "Reserved Font Name" refers to any names specified as such after the + * copyright statement(s). + * + * "Original Version" refers to the collection of Font Software components as + * distributed by the Copyright Holder(s). + * + * "Modified Version" refers to any derivative made by adding to, deleting, + * or substituting -- in part or in whole -- any of the components of the + * Original Version, by changing formats or by porting the Font Software to a + * new environment. + * + * "Author" refers to any designer, engineer, programmer, technical + * writer or other person who contributed to the Font Software. + * + * PERMISSION & CONDITIONS + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of the Font Software, to use, study, copy, merge, embed, modify, + * redistribute, and sell modified and unmodified copies of the Font + * Software, subject to the following conditions: + * + * 1) Neither the Font Software nor any of its individual components, + * in Original or Modified Versions, may be sold by itself. + * + * 2) Original or Modified Versions of the Font Software may be bundled, + * redistributed and/or sold with any software, provided that each copy + * contains the above copyright notice and this license. These can be + * included either as stand-alone text files, human-readable headers or + * in the appropriate machine-readable metadata fields within text or + * binary files as long as those fields can be easily viewed by the user. + * + * 3) No Modified Version of the Font Software may use the Reserved Font + * Name(s) unless explicit written permission is granted by the corresponding + * Copyright Holder. This restriction only applies to the primary font name as + * presented to the users. + * + * 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font + * Software shall not be used to promote, endorse or advertise any + * Modified Version, except to acknowledge the contribution(s) of the + * Copyright Holder(s) and the Author(s) or with their explicit written + * permission. + * + * 5) The Font Software, modified or unmodified, in part or in whole, + * must be distributed entirely under this license, and must not be + * distributed under any other license. The requirement for fonts to + * remain under this license does not apply to any document created + * using the Font Software. + * + * TERMINATION + * This license becomes null and void if any of the above conditions are + * not met. + * + * DISCLAIMER + * THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + * OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM + * OTHER DEALINGS IN THE FONT SOFTWARE. + */ + diff --git a/css/rdoc.css b/css/rdoc.css new file mode 100644 index 0000000..ebe2e93 --- /dev/null +++ b/css/rdoc.css @@ -0,0 +1,639 @@ +/* + * "Darkfish" Rdoc CSS + * $Id: rdoc.css 54 2009-01-27 01:09:48Z deveiant $ + * + * Author: Michael Granger + * + */ + +/* vim: ft=css et sw=2 ts=2 sts=2 */ +/* Base Green is: #6C8C22 */ + +.hide { display: none !important; } + +* { padding: 0; margin: 0; } + +body { + background: #fafafa; + font-family: Lato, sans-serif; + font-weight: 300; +} + +h1 span, +h2 span, +h3 span, +h4 span, +h5 span, +h6 span { + position: relative; + + display: none; + padding-left: 1em; + line-height: 0; + vertical-align: baseline; + font-size: 10px; +} + +h1 span { top: -1.3em; } +h2 span { top: -1.2em; } +h3 span { top: -1.0em; } +h4 span { top: -0.8em; } +h5 span { top: -0.5em; } +h6 span { top: -0.5em; } + +h1:hover span, +h2:hover span, +h3:hover span, +h4:hover span, +h5:hover span, +h6:hover span { + display: inline; +} + +h1:target, +h2:target, +h3:target, +h4:target, +h5:target, +h6:target { + margin-left: -10px; + border-left: 10px solid #f1edba; +} + +:link, +:visited { + color: #6C8C22; + text-decoration: none; +} + +:link:hover, +:visited:hover { + border-bottom: 1px dotted #6C8C22; +} + +code, +pre { + font-family: "Source Code Pro", Monaco, monospace; + background-color: rgba(27,31,35,0.05); + padding: 0em 0.2em; + border-radius: 0.2em; +} + +table { + margin: 0; + border-spacing: 0; + border-collapse: collapse; +} + +table tr th, table tr td { + padding: 0.2em 0.4em; + border: 1px solid #ccc; +} + +table tr th { + background-color: #eceaed; +} + +table tr:nth-child(even) td { + background-color: #f5f4f6; +} + +/* @group Generic Classes */ + +.initially-hidden { + display: none; +} + +#search-field { + width: 98%; + background: white; + border: none; + height: 1.5em; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + text-align: left; +} +#search-field:focus { + background: #f1edba; +} +#search-field:-moz-placeholder, +#search-field::-webkit-input-placeholder { + font-weight: bold; + color: #666; +} + +.missing-docs { + font-size: 120%; + background: white url(../images/wrench_orange.png) no-repeat 4px center; + color: #ccc; + line-height: 2em; + border: 1px solid #d00; + opacity: 1; + padding-left: 20px; + text-indent: 24px; + letter-spacing: 3px; + font-weight: bold; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; +} + +.target-section { + border: 2px solid #dcce90; + border-left-width: 8px; + padding: 0 1em; + background: #fff3c2; +} + +/* @end */ + +/* @group Index Page, Standalone file pages */ +.table-of-contents ul { + margin: 1em; + list-style: none; +} + +.table-of-contents ul ul { + margin-top: 0.25em; +} + +.table-of-contents ul :link, +.table-of-contents ul :visited { + font-size: 16px; +} + +.table-of-contents li { + margin-bottom: 0.25em; +} + +.table-of-contents li .toc-toggle { + width: 16px; + height: 16px; + background: url(../images/add.png) no-repeat; +} + +.table-of-contents li .toc-toggle.open { + background: url(../images/delete.png) no-repeat; +} + +/* @end */ + +/* @group Top-Level Structure */ + +nav { + float: left; + width: 260px; + font-family: Helvetica, sans-serif; + font-size: 14px; + border-right: 1px solid #ccc; +} + +main { + display: block; + margin: 0 2em 5em 260px; + padding-left: 20px; + min-width: 340px; + font-size: 16px; +} + +main h1, +main h2, +main h3, +main h4, +main h5, +main h6 { + font-family: Helvetica, sans-serif; +} + +.table-of-contents main { + margin-left: 2em; +} + +#validator-badges { + clear: both; + margin: 1em 1em 2em; + font-size: smaller; +} + +/* @end */ + +/* @group navigation */ +nav { + margin-bottom: 1em; +} + +nav .nav-section { + margin-top: 2em; + border-top: 2px solid #aaa; + font-size: 90%; + overflow: hidden; +} + +nav h2 { + margin: 0; + padding: 2px 8px 2px 8px; + background-color: #e8e8e8; + color: #555; + font-size: 125%; + text-align: center; +} + +nav h3, +#table-of-contents-navigation { + margin: 0; + padding: 2px 8px 2px 8px; + text-align: right; + background-color: #e8e8e8; + color: #555; +} + +nav ul, +nav dl, +nav p { + padding: 4px 8px 0; + list-style: none; +} + +#project-navigation .nav-section { + margin: 0; + border-top: 0; +} + +#home-section h2 { + text-align: center; +} + +#table-of-contents-navigation { + font-size: 1.2em; + font-weight: bold; + text-align: center; +} + +#search-section { + margin-top: 0; + border-top: 0; +} + +#search-field-wrapper { + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; + padding: 3px 8px; + background-color: #e8e8e8; + color: #555; +} + +ul.link-list li { + white-space: nowrap; + line-height: 1.4em; +} + +ul.link-list .type { + font-size: 8px; + text-transform: uppercase; + color: white; + background: #969696; + padding: 2px 4px; + -webkit-border-radius: 5px; +} + +dl.note-list dt { + float: left; + margin-right: 1em; +} + +.calls-super { + background: url(../images/arrow_up.png) no-repeat right center; +} + +/* @end */ + +/* @group Documentation Section */ +main { + color: #333; +} + +main > h1:first-child, +main > h2:first-child, +main > h3:first-child, +main > h4:first-child, +main > h5:first-child, +main > h6:first-child { + margin-top: 0px; +} + +main sup { + vertical-align: super; + font-size: 0.8em; +} + +/* The heading with the class name */ +main h1[class] { + margin-top: 0; + margin-bottom: 1em; + font-size: 2em; + color: #6C8C22; +} + +main h1 { + margin: 2em 0 0.5em; + font-size: 1.7em; +} + +main h2 { + margin: 2em 0 0.5em; + font-size: 1.5em; +} + +main h3 { + margin: 2em 0 0.5em; + font-size: 1.2em; +} + +main h4 { + margin: 2em 0 0.5em; + font-size: 1.1em; +} + +main h5 { + margin: 2em 0 0.5em; + font-size: 1em; +} + +main h6 { + margin: 2em 0 0.5em; + font-size: 1em; +} + +main p { + margin: 0 0 0.5em; + line-height: 1.4em; +} + +main pre { + margin: 1.2em 0.5em; + padding: 1em; + font-size: 0.8em; +} + +main hr { + margin: 1.5em 1em; + border: 2px solid #ddd; +} + +main blockquote { + margin: 0 2em 1.2em 1.2em; + padding-left: 0.5em; + border-left: 2px solid #ddd; +} + +main ol, +main ul { + margin: 1em 2em; +} + +main li > p { + margin-bottom: 0.5em; +} + +main dl { + margin: 1em 0.5em; +} + +main dt { + margin-bottom: 0.5em; + font-weight: bold; +} + +main dd { + margin: 0 1em 1em 0.5em; +} + +main header h2 { + margin-top: 2em; + border-width: 0; + border-top: 4px solid #bbb; + font-size: 130%; +} + +main header h3 { + margin: 2em 0 1.5em; + border-width: 0; + border-top: 3px solid #bbb; + font-size: 120%; +} + +.documentation-section-title { + position: relative; +} +.documentation-section-title .section-click-top { + position: absolute; + top: 6px; + left: 12px; + font-size: 10px; + color: #9b9877; + visibility: hidden; + padding-left: 0.5px; +} + +.documentation-section-title:hover .section-click-top { + visibility: visible; +} + +.constants-list > dl { + margin: 1em 0 2em; + border: 0; +} + +.constants-list > dl dt { + margin-bottom: 0.75em; + padding-left: 0; + font-family: "Source Code Pro", Monaco, monospace; + font-size: 110%; +} + +.constants-list > dl dt a { + color: inherit; +} + +.constants-list > dl dd { + margin: 0 0 2em 0; + padding: 0; + color: #666; +} + +.documentation-section h2 { + position: relative; +} + +.documentation-section h2 a { + position: absolute; + top: 8px; + right: 10px; + font-size: 12px; + color: #9b9877; + visibility: hidden; +} + +.documentation-section h2:hover a { + visibility: visible; +} + +/* @group Method Details */ + +main .method-source-code { + max-height: 0; + overflow: hidden; + transition-duration: 200ms; + transition-delay: 0ms; + transition-property: all; + transition-timing-function: ease-in-out; +} + +main .method-source-code.active-menu { + max-height: 100vh; +} + +main .method-description .method-calls-super { + color: #333; + font-weight: bold; +} + +main .method-detail { + margin-bottom: 2.5em; + cursor: pointer; +} + +main .method-detail:target { + margin-left: -10px; + border-left: 10px solid #f1edba; +} + +main .method-heading { + position: relative; + font-family: "Source Code Pro", Monaco, monospace; + font-size: 110%; + font-weight: bold; + color: #333; +} +main .method-heading :link, +main .method-heading :visited { + color: inherit; +} +main .method-click-advice { + position: absolute; + top: 2px; + right: 5px; + font-size: 12px; + color: #9b9877; + visibility: hidden; + padding-right: 20px; + line-height: 20px; + background: url(../images/zoom.png) no-repeat right top; +} +main .method-heading:hover .method-click-advice { + visibility: visible; +} + +main .method-alias .method-heading { + color: #666; +} + +main .method-description, +main .aliases { + margin-top: 0.75em; + color: #333; +} + +main .aliases { + padding-top: 4px; + font-style: italic; + cursor: default; +} +main .method-description ul { + margin-left: 1.5em; +} + +main #attribute-method-details .method-detail:hover { + background-color: transparent; + cursor: default; +} +main .attribute-access-type { + text-transform: uppercase; + padding: 0 1em; +} +/* @end */ + +/* @end */ + +/* @group Source Code */ + +pre { + margin: 0.5em 0; + border: 1px dashed #999; + padding: 0.5em; + background: #262626; + color: white; + overflow: auto; +} + +.ruby-constant { color: #7fffd4; background: transparent; } +.ruby-keyword { color: #00ffff; background: transparent; } +.ruby-ivar { color: #eedd82; background: transparent; } +.ruby-operator { color: #00ffee; background: transparent; } +.ruby-identifier { color: #ffdead; background: transparent; } +.ruby-node { color: #ffa07a; background: transparent; } +.ruby-comment { color: #dc0000; background: transparent; } +.ruby-regexp { color: #ffa07a; background: transparent; } +.ruby-value { color: #7fffd4; background: transparent; } + +/* @end */ + + +/* @group search results */ +#search-results { + font-family: Lato, sans-serif; + font-weight: 300; +} + +#search-results .search-match { + font-family: Helvetica, sans-serif; + font-weight: normal; +} + +#search-results .search-selected { + background: #e8e8e8; + border-bottom: 1px solid transparent; +} + +#search-results li { + list-style: none; + border-bottom: 1px solid #aaa; + margin-bottom: 0.5em; +} + +#search-results li:last-child { + border-bottom: none; + margin-bottom: 0; +} + +#search-results li p { + padding: 0; + margin: 0.5em; +} + +#search-results .search-namespace { + font-weight: bold; +} + +#search-results li em { + background: yellow; + font-style: normal; +} + +#search-results pre { + margin: 0.5em; + font-family: "Source Code Pro", Monaco, monospace; +} + +/* @end */ + diff --git a/docs/Array.html b/docs/Array.html deleted file mode 100644 index 2a6d8e5..0000000 --- a/docs/Array.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -class Array - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class Array -

- -
- -
- -
- - - - - -
-
- - - - diff --git a/docs/Code-of-Conduct_md.html b/docs/Code-of-Conduct_md.html deleted file mode 100644 index c8f7f5d..0000000 --- a/docs/Code-of-Conduct_md.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - -Code-of-Conduct - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
- -

Contributor Covenant Code of Conduct

- -

Our Pledge

- -

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

- -

Our Standards

- -

Examples of behavior that contributes to creating a positive environment include:

-
  • -

    Using welcoming and inclusive language

    -
  • -

    Being respectful of differing viewpoints and experiences

    -
  • -

    Gracefully accepting constructive criticism

    -
  • -

    Focusing on what is best for the community

    -
  • -

    Showing empathy towards other community members

    -
- -

Examples of unacceptable behavior by participants include:

-
  • -

    The use of sexualized language or imagery and unwelcome sexual attention or advances

    -
  • -

    Trolling, insulting/derogatory comments, and personal or political attacks

    -
  • -

    Public or private harassment

    -
  • -

    Publishing others' private information, such as a physical or electronic address, without explicit permission

    -
  • -

    Other conduct which could reasonably be considered inappropriate in a professional setting

    -
- -

Our Responsibilities

- -

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

- -

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

- -

Scope

- -

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

- -

Enforcement

- -

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [INSERT EMAIL ADDRESS]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

- -

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

- -

Attribution

- -

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at contributor-covenant.org/version/1/4

- -
- - - - - diff --git a/docs/Contributing_md.html b/docs/Contributing_md.html deleted file mode 100644 index 09d1a46..0000000 --- a/docs/Contributing_md.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - -Contributing - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
- -

Contributing

- -

I value any contribution to Diff::LCS you can provide: a bug report, a feature request, or code contributions. Code contributions to Diff::LCS are especially <del>welcome</del>encouraged. Because Diff::LCS is a complex codebase, there are a few guidelines:

-
  • -

    Code changes will not be accepted without tests. The test suite is written with [RSpec][].

    -
  • -

    Match my coding style.

    -
  • -

    Use a thoughtfully-named topic branch that contains your change. Rebase your commits into logical chunks as necessary.

    -
  • -

    Use quality commit messages.

    -
  • -

    Do not change the version number; when your patch is accepted and a release is made, the version will be updated at that point.

    -
  • -

    Submit a GitHub pull request with your changes.

    -
  • -

    New or changed behaviours require appropriate documentation.

    -
- -

Test Dependencies

- -

Diff::LCS uses Ryan Davis’s [Hoe][] to manage the release process, and it adds a number of rake tasks. You will mostly be interested in:

- -
$ rake
- -

which runs the tests the same way that:

- -
$ rake spec
- -

will do.

- -

To assist with the installation of the development dependencies, I have provided a Gemfile pointing to the (generated) diff-lcs.gemspec file. This will permit you to do:

- -
$ bundle install
- -

to get the development dependencies. If you aleady have hoe installed, you can accomplish the same thing with:

- -
$ rake newb
- -

This task will install any missing dependencies, run the tests/specs, and generate the RDoc.

- -

You can run tests with code coverage analysis by running:

- -
$ rake spec:coverage
- -

Workflow

- -

Here's the most direct way to get your work merged into the project:

-
  • -

    Fork the project.

    -
  • -

    Clone down your fork (git clone git://github.com/<username>/diff-lcs.git).

    -
  • -

    Create a topic branch to contain your change (git checkout -b my_awesome_feature).

    -
  • -

    Hack away, add tests. Not necessarily in that order.

    -
  • -

    Make sure everything still passes by running rake.

    -
  • -

    If necessary, rebase your commits into logical chunks, without errors.

    -
  • -

    Push the branch up (git push origin my_awesome_feature).

    -
  • -

    Create a pull request against halostatue/diff-lcs and describe what your change does and the why you think it should be merged.

    -
- -

Contributors

- - -

Thanks to everyone else who has contributed code or bug reports to Diff::LCS:

-
  • -

    @ginriki

    -
  • -

    @joshbronson

    -
  • -

    @kevinmook

    -
  • -

    @mckaz

    -
  • -

    Akinori Musha

    -
  • -

    Artem Ignatyev

    -
  • -

    Brandon Fish

    -
  • -

    Camille Drapier

    -
  • -

    Cédric Boutillier

    -
  • -

    Gregg Kellogg

    -
  • -

    Jagdeep Singh

    -
  • -

    Jason Gladish

    -
  • -

    Jon Rowe

    -
  • -

    Josef Strzibny

    -
  • -

    Josep (@apuratepp)

    -
  • -

    Josh Bronson

    -
  • -

    Jun Aruga

    -
  • -

    Kenichi Kamiya

    -
  • -

    Kensuke Nagae

    -
  • -

    Kevin Ansfield

    -
  • -

    Koichi Ito

    -
  • -

    Mark Friedgan

    -
  • -

    Michael Granger

    -
  • -

    Myron Marston

    -
  • -

    Nicolas Leger

    -
  • -

    Oleg Orlov

    -
  • -

    Paul Kunysch

    -
  • -

    Pete Higgins

    -
  • -

    Peter Wagenet

    -
  • -

    Philippe Lafoucrière

    -
  • -

    Ryan Lovelett

    -
  • -

    Scott Steele

    -
  • -

    Simon Courtois

    -
  • -

    Tien (@tiendo1011)

    -
  • -

    Tomas Jura

    -
  • -

    Vít Ondruch

    -
- -
- - - - - diff --git a/docs/Diff.html b/docs/Diff.html deleted file mode 100644 index 8fa95fe..0000000 --- a/docs/Diff.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - -module Diff - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- module Diff -

- -
- -
- -
- - - - - -
-
- - - - diff --git a/docs/Diff/LCS/Internals.html b/docs/Diff/LCS/Internals.html deleted file mode 100644 index b1ccf43..0000000 --- a/docs/Diff/LCS/Internals.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - -module Diff::LCS::Internals - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- module Diff::LCS::Internals -

- -
- -
- -
- - - - - -
-
-

Public Class Methods

-
- -
-
- analyze_patchset(patchset, depth = 0) - click to toggle source -
- -
-

This method will analyze the provided patchset to provide a single-pass normalization (conversion of the array form of Diff::LCS::Change objects to the object form of same) and detection of whether the patchset represents changes to be made.

- -
-
# File lib/diff/lcs/internals.rb, line 102
-def analyze_patchset(patchset, depth = 0)
-  fail 'Patchset too complex' if depth > 1
-
-  has_changes = false
-  new_patchset = []
-
-  # Format:
-  # [ # patchset
-  #   # hunk (change)
-  #   [ # hunk
-  #     # change
-  #   ]
-  # ]
-
-  patchset.each do |hunk|
-    case hunk
-    when Diff::LCS::Change
-      has_changes ||= !hunk.unchanged?
-      new_patchset << hunk
-    when Array
-      # Detect if the 'hunk' is actually an array-format change object.
-      if Diff::LCS::Change.valid_action? hunk[0]
-        hunk = Diff::LCS::Change.from_a(hunk)
-        has_changes ||= !hunk.unchanged?
-        new_patchset << hunk
-      else
-        with_changes, hunk = analyze_patchset(hunk, depth + 1)
-        has_changes ||= with_changes
-        new_patchset.concat(hunk)
-      end
-    else
-      fail ArgumentError, "Cannot normalise a hunk of class #{hunk.class}."
-    end
-  end
-
-  [has_changes, new_patchset]
-end
-
-
- - -
- -
-
- intuit_diff_direction(src, patchset, limit = nil) - click to toggle source -
- -
-

Examine the patchset and the source to see in which direction the patch should be applied.

- -

WARNING: By default, this examines the whole patch, so this could take some time. This also works better with Diff::LCS::ContextChange or Diff::LCS::Change as its source, as an array will cause the creation of one of the above.

- -
-
# File lib/diff/lcs/internals.rb, line 147
-  def intuit_diff_direction(src, patchset, limit = nil)
-    string = src.kind_of?(String)
-    count = left_match = left_miss = right_match = right_miss = 0
-
-    patchset.each do |change|
-      count += 1
-
-      case change
-      when Diff::LCS::ContextChange
-        le = string ? src[change.old_position, 1] : src[change.old_position]
-        re = string ? src[change.new_position, 1] : src[change.new_position]
-
-        case change.action
-        when '-' # Remove details from the old string
-          if le == change.old_element
-            left_match += 1
-          else
-            left_miss += 1
-          end
-        when '+'
-          if re == change.new_element
-            right_match += 1
-          else
-            right_miss += 1
-          end
-        when '='
-          left_miss += 1 if le != change.old_element
-          right_miss += 1 if re != change.new_element
-        when '!'
-          if le == change.old_element
-            left_match += 1
-          elsif re == change.new_element
-            right_match += 1
-          else
-            left_miss += 1
-            right_miss += 1
-          end
-        end
-      when Diff::LCS::Change
-        # With a simplistic change, we can't tell the difference between
-        # the left and right on '!' actions, so we ignore those. On '='
-        # actions, if there's a miss, we miss both left and right.
-        element = string ? src[change.position, 1] : src[change.position]
-
-        case change.action
-        when '-'
-          if element == change.element
-            left_match += 1
-          else
-            left_miss += 1
-          end
-        when '+'
-          if element == change.element
-            right_match += 1
-          else
-            right_miss += 1
-          end
-        when '='
-          if element != change.element
-            left_miss += 1
-            right_miss += 1
-          end
-        end
-      end
-
-      break if !limit.nil? && (count > limit)
-    end
-
-    no_left = left_match.zero? && left_miss.positive?
-    no_right = right_match.zero? && right_miss.positive?
-
-    case [no_left, no_right]
-    when [false, true]
-      :patch
-    when [true, false]
-      :unpatch
-    else
-      case left_match <=> right_match
-      when 1
-        if left_miss.zero?
-          :patch
-        else
-          :unpatch
-        end
-      when -1
-        if right_miss.zero?
-          :unpatch
-        else
-          :patch
-        end
-      else
-        fail "The provided patchset does not appear to apply to the provided \
-enumerable as either source or destination value."
-      end
-    end
-  end
-
-
- - -
- -
-
- lcs(a, b) - click to toggle source -
- -
-

Compute the longest common subsequence between the sequenced Enumerables a and b. The result is an array whose contents is such that

- -
result = Diff::LCS::Internals.lcs(a, b)
-result.each_with_index do |e, i|
-  assert_equal(a[i], b[e]) unless e.nil?
-end
-
- -
-
# File lib/diff/lcs/internals.rb, line 41
-def lcs(a, b)
-  a_start = b_start = 0
-  a_finish = a.size - 1
-  b_finish = b.size - 1
-  vector = []
-
-  # Collect any common elements at the beginning...
-  while (a_start <= a_finish) and (b_start <= b_finish) and (a[a_start] == b[b_start])
-    vector[a_start] = b_start
-    a_start += 1
-    b_start += 1
-  end
-
-  # Now the end...
-  while (a_start <= a_finish) and (b_start <= b_finish) and (a[a_finish] == b[b_finish])
-    vector[a_finish] = b_finish
-    a_finish -= 1
-    b_finish -= 1
-  end
-
-  # Now, compute the equivalence classes of positions of elements.
-  # An explanation for how this works: https://codeforces.com/topic/92191
-  b_matches = position_hash(b, b_start..b_finish)
-
-  thresh = []
-  links  = []
-  string = a.kind_of?(String)
-
-  (a_start..a_finish).each do |i|
-    ai = string ? a[i, 1] : a[i]
-    bm = b_matches[ai]
-    k = nil
-    bm.reverse_each do |j|
-      # Although the threshold check is not mandatory for this to work,
-      # it may have an optimization purpose
-      # An attempt to remove it: https://github.com/halostatue/diff-lcs/pull/72
-      # Why it is reintroduced: https://github.com/halostatue/diff-lcs/issues/78
-      if k and (thresh[k] > j) and (thresh[k - 1] < j)
-        thresh[k] = j
-      else
-        k = replace_next_larger(thresh, j, k)
-      end
-      links[k] = [k.positive? ? links[k - 1] : nil, i, j] unless k.nil?
-    end
-  end
-
-  unless thresh.empty?
-    link = links[thresh.size - 1]
-    until link.nil?
-      vector[link[1]] = link[2]
-      link = link[0]
-    end
-  end
-
-  vector
-end
-
-
- - -
- -
- -
-
- - - - diff --git a/docs/Diff/LCS/Ldiff.html b/docs/Diff/LCS/Ldiff.html deleted file mode 100644 index 3b618d6..0000000 --- a/docs/Diff/LCS/Ldiff.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - -module Diff::LCS::Ldiff - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- module Diff::LCS::Ldiff -

- -
- -
- -
- - - - - -
-
- - - - diff --git a/docs/Fixnum.html b/docs/Fixnum.html deleted file mode 100644 index 69b409d..0000000 --- a/docs/Fixnum.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - -class Fixnum - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class Fixnum -

- -
- -
- -
- - - - - -
-
-

Public Instance Methods

-
- -
-
- positive?() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/backports.rb, line 5
-def positive?
-  self > 0 # rubocop:disable Style/NumericPredicate
-end
-
-
- - -
- -
- -
-
- - - - diff --git a/docs/History_md.html b/docs/History_md.html deleted file mode 100644 index b071f53..0000000 --- a/docs/History_md.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - -History - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
- -

History

- -

1.5.0 / 2021-12-23

-
  • -

    Updated the CI configuration and monkey-patch Hoe.

    -
  • -

    Kenichi Kamiya fixed a test configuration deprecation in SimpleCov. #69

    -
  • -

    Tien introduced several corrections and code improvements:

    -
  • -

    Removed an off-by-one error when calculating an index value by embracing Ruby iteration properly. This had a side-effect of fixing a long-standing bug in #traverse_sequences where the traversal would not be transitive. That is, LCS(s2, s1) should produce a sequence that is transitive with LCS(s1, s2) on traversal, and applying the diff computed from those results would result in equivalent changes that could be played forward or backward as appropriate. #71, #75

    -
  • -

    The above fix resulted in a changed order of the longest common subsequence when callbacks were applied. After analysis, it was determined that the computed subsequence was equivalent to the prior version, so the test was updated. This also resulted in the clarification of documentation when traversing the subsequences. #79

    -
  • -

    An infinite loop case in the case where Diff::LCS would be included into an enumerable class has been fixed. #73

    -
  • -

    Clarified the purpose of a threshold test in calculation of LCS. #72, #80

    -
  • -

    Removed autotest directory

    -
- -

1.4.4 / 2020-07-01

-
  • -

    Fixed an issue reported by Jun Aruga in the Diff::LCS::Ldiff binary text detection. #44

    -
  • -

    Fixed a theoretical issue reported by Jun Aruga in Diff::LCS::Hunk to raise a more useful exception. #43

    -
  • -

    Added documentation that should address custom object issues as reported in #35.

    -
  • -

    Fixed more diff errors, in part reported in #65.

    -
  • -

    The use of Numeric#abs is incorrect in Diff::LCS::Block#diff_size. The diff size must be accurate for correct change placement.

    -
  • -

    When selecting @max_diff_size in Diff::LCS::Hunk, choose it based on block.diff_size.abs.

    -
  • -

    Made a number of changes that will, unfortunately, increase allocations at the cost of being safe with frozen strings.

    -
  • -

    Add some knowledge that when Diff::LCS::Hunk#diff is called, that we are processing the last hunk, so some changes will be made to how the output is generated.

    -
    • -

      old, ed, and reverse_ed formats have no differences.

      -
    • -

      unified format will report \ No newline at end of file given the correct conditions, at most once. Unified range reporting also differs for the last hunk such that the length of the range is reduced by one.

      -
    • -

      context format will report \No newline at end of file given the correct conditions, up to once per “file”. Context range reporting also differs for the last hunk such that the end part of the range is reduced by one to a minimum of one.

      -
    -
  • -

    Added a bunch more tests for the cases above, and fixed hunk_spec.rb so that the phrase being compared isn't nonsense French.

    -
  • -

    Updated formatting.

    -
  • -

    Added a Rake task to assist with manual testing on Ruby 1.8.

    -
- -

1.4.3 / 2020-06-29

-
  • -

    Fixed several issues with the 1.4 on Rubies older than 2.0. Some of this was providing useful shim functions to Hoe 3.x (which dropped these older Rubies a while ago). Specifically:

    -
  • -

    Removed Array#lazy from a method in Diff::LCS::Hunk.

    -
  • -

    Changed some unit tests to use old-style Symbol-keyed hashes.

    -
  • -

    Changed some unit test helper functions to no longer use keyword parameters, but only a trailing options hash.

    -
  • -

    Made the use of psych dependent on RUBY_VERSION >= 1.9.

    -
- -

Resolves #63.

- -

1.4.2 / 2020-06-23

-
  • -

    Camille Drapier fixed a small issue with RuboCop configuration. #59

    -
  • -

    Applied another fix (and unit test) to fix an issue for the Chef team. #60, #61

    -
- -

1.4.1 / 2020-06-23

-
  • -

    Fix an issue where diff sizes could be negative, and they should be. #57, #58

    -
- -

1.4 / 2020-06-23

-
  • -

    Ruby versions lower than 2.4 are soft-deprecated and will not be run as part of the CI process any longer.

    -
  • -

    Akinora MUSHA (knu) added the ability for Diff::LCS::Change objects to be implicitly treated arrays. Originally provided as pull request #47, but it introduced a number of test failures as documented in #48, and remediation of Diff::LCS itself was introduced in #49.

    -
  • -

    Resolved #5 with some tests comparing output from system calls to bin/ldiff with some pre-generated output. Resolved #6 with these tests.

    -
  • -

    Resolved a previously undetected bin/ldiff issue with --context output not matching diff --context output.

    -
  • -

    Resolved an issue with later versions of Ruby not working with an OptParse specification of Numeric; this has been changed to Integer.

    -
  • -

    Brandon Fish added truffleruby in #52.

    -
  • -

    Fixed two missing classes as reported in #53.

    -
- -

1.3 / 2017-01-18

-
  • -

    Bugs fixed:

    -
  • -

    Fixed an error for bin/ldiff --version. Fixes issue #21.

    -
  • -

    Force Diff::LCS::Change and Diff::LCS::ContextChange to only perform equality comparisons against themselves. Provided by Kevin Mook in pull request #29.

    -
  • -

    Fix tab expansion in htmldiff, provided by Mark Friedgan in pull request #25.

    -
  • -

    Silence Ruby 2.4 Fixnum deprecation warnings. Fixes issue #38 and pull request #36.

    -
  • -

    Ensure that test dependencies are loaded properly. Fixes issue #33 and pull request #34.

    -
  • -

    Fix issue #1 with incorrect intuition of patch direction. Tentative fix, but the previous failure cases pass now.

    -
  • -

    Tooling changes:

    -
  • -

    Added SimpleCov and Coveralls support.

    -
  • -

    Change the homepage (temporarily) to the GitHub repo.

    -
  • -

    Updated testing and gem infrastructure.

    -
  • -

    Modernized the specs.

    -
  • -

    Cleaned up documentation.

    -
  • -

    Added a Code of Conduct.

    -
- -

1.2.5 / 2013-11-08

-
  • -

    Bugs fixed:

    -
  • -

    Comparing arrays flattened them too far, especially with Diff::LCS.sdiff. Fixed by Josh Bronson in pull request #23.

    -
- -

1.2.4 / 2013-04-20

-
  • -

    Bugs fixed:

    -
  • -

    A bug was introduced after 1.1.3 when pruning common sequences at the start of comparison. Paul Kunysch (@pck) fixed this in pull request #18. Thanks!

    -
  • -

    The Rubinius (1.9 mode) bug in rubinius/rubinius#2268 has been fixed by the Rubinius team two days after it was filed. Thanks for fixing this so quickly!

    -
  • -

    Switching to Raggi's hoe-gemspec2 for gemspec generation.

    -
- -

1.2.3 / 2013-04-11

-
  • -

    Bugs Fixed:

    -
  • -

    The new encoding detection for diff output generation (added in 1.2.2) introduced a bug if the left side of the comparison was the empty set. Originally found in rspec/rspec-expectations#238 and rspec/rspec-expectations#239. Jon Rowe developed a reasonable heuristic (left side, right side, empty string literal) to avoid this bug.

    -
  • -

    There is a known issue with Rubinius in 1.9 mode reported in rubinius/rubinius#2268 and demonstrated in the Travis CI builds. For all other tested platforms, diff-lcs is considered stable. As soon as a suitably small test-case can be created for the Rubinius team to examine, this will be added to the Rubinius issue around this.

    -
- -

1.2.2 / 2013-03-30

-
  • -

    Bugs Fixed:

    -
  • -

    Diff::LCS::Hunk could not properly generate a difference for comparison sets that are not US-ASCII-compatible because of the use of literal regular expressions and strings. Jon Rowe found this in rspec/rspec-expectations#219 and provided a first pass implementation in pull request #15. I've reworked it because of test failures in Rubinius when running in Ruby 1.9 mode. This coerces the added values to the encoding of the old dataset (as determined by the first piece of the old dataset).

    -
  • -

    Adding Travis CI testing for Ruby 2.0.

    -
- -

1.2.1 / 2013-02-09

-
  • -

    Bugs Fixed:

    -
  • -

    As seen in rspec/rspec-expectations#200, the release of Diff::LCS 1.2 introduced an unnecessary public API change to Diff::LCS::Hunk (see the change at rspec/rspec-expectations@3d6fc82c for details). The new method name (and behaviour) is more correct, but I should not have renamed the function or should have at least provided an alias. This release restores Diff::LCS::Hunk#unshift as an alias to merge. Note that the old unshift behaviour was incorrect and will not be restored.

    -
- -

1.2.0 / 2013-01-21

-
  • -

    Minor Enhancements:

    -
  • -

    Added special case handling for Diff::LCS.patch so that it handles patches that are empty or contain no changes.

    -
  • -

    Added two new methods (patch_me and unpatch_me) to the includable module.

    -
  • -

    Bugs Fixed:

    -
  • -

    Fixed issue #1 patch direction detection.

    -
  • -

    Resolved issue #2 by handling string[string.size, 1] properly (it returns "" not nil).

    -
  • -

    Michael Granger (ged) fixed an implementation error in Diff::LCS::Change and added specs in pull request #8. Thanks!

    -
  • -

    Made the code auto-testable.

    -
  • -

    Vít Ondruch (voxik) provided the latest version of the GPL2 license file in pull request #10. Thanks!

    -
  • -

    Fixed a documentation issue with the includable versions of patch! and

    - -

    unpatch! where they implied that they would replace the original value.

    - -

    Given that Diff::LCS.patch always returns a copy, the documentation was incorrect and has been corrected. To provide the behaviour that was originally documented, two new methods were added to provide this behaviour. Found by scooter-dangle in issue #12. Thanks!

    -
  • -

    Code Style Changes:

    -
  • -

    Removed trailing spaces.

    -
  • -

    Calling class methods using . instead of ::.

    -
  • -

    Vít Ondruch (voxik) removed unnecessary shebangs in pull request #9. Thanks!

    -
  • -

    Kenichi Kamiya (kachick) removed some warnings of an unused variable in lucky pull request #13. Thanks!

    -
  • -

    Embarked on a major refactoring to make the files a little more manageable and understand the code on a deeper level.

    -
  • -

    Adding to travis-ci.org.

    -
- -

1.1.3 / 2011-08-27

-
  • -

    Converted to 'hoe' for release.

    -
  • -

    Converted tests to RSpec 2.

    -
  • -

    Extracted the body of htmldiff into a class available from diff/lcs/htmldiff.

    -
  • -

    Migrated development and issue tracking to GitHub.

    -
  • -

    Bugs fixed:

    -
  • -

    Eliminated the explicit use of RubyGems in both bin/htmldiff and bin/ldiff. Resolves issue #4.

    -
  • -

    Eliminated Ruby warnings. Resolves issue #3.

    -
- -

1.1.2 / 2004-10-20

-
  • -

    Fixed a problem reported by Mauricio Fernandez in htmldiff.

    -
- -

1.1.1 / 2004-09-25

-
  • -

    Fixed bug #891 (Set returned from patch command does not contain last equal part).

    -
  • -

    Fixed a problem with callback initialisation code (it assumed that all callbacks passed as classes can be initialised; now, it rescues NoMethodError in the event of private :new being called).

    -
  • -

    Modified the non-initialisable callbacks to have a private new method.

    -
  • -

    Moved ldiff core code to Diff::LCS::Ldiff (diff/lcs/ldiff.rb).

    -
- -

1.1.0

-
  • -

    Eliminated the need for Diff::LCS::Event and removed it.

    -
  • -

    Added a contextual diff callback, Diff::LCS::ContextDiffCallback.

    -
  • -

    Implemented patching/unpatching for standard Diff callback output formats with both diff and sdiff.

    -
  • -

    Extensive documentation changes.

    -
- -

1.0.4

-
  • -

    Fixed a problem with bin/ldiff output, especially for unified format. Newlines that should have been present weren't.

    -
  • -

    Changed the .tar.gz installer to generate Windows batch files if ones do not exist already. Removed the existing batch files as they didn't work.

    -
- -

1.0.3

-
  • -

    Fixed a problem with traverse_sequences where the first difference from the left sequence might not be appropriately captured.

    -
- -

1.0.2

-
  • -

    Fixed an issue with ldiff not working because actions were changed from symbols to strings.

    -
- -

1.0.1

-
  • -

    Minor modifications to the gemspec, the README.

    -
  • -

    Renamed the diff program to ldiff (as well as the companion batch file) so as to not collide with the standard diff program.

    -
  • -

    Fixed issues with RubyGems. Requires RubyGems > 0.6.1 or >= 0.6.1 with the latest CVS version.

    -
- -

1.0

-
  • -

    Initial release based mostly on Perl's Algorithm::Diff.

    -
- -
- - - - - diff --git a/docs/LCS.html b/docs/LCS.html deleted file mode 100644 index ef19930..0000000 --- a/docs/LCS.html +++ /dev/null @@ -1,1119 +0,0 @@ - - - - - - -module LCS - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- module LCS -

- -
- -

How Diff Works (by Mark-Jason Dominus)

- -

I once read an article written by the authors of diff; they said that they hard worked very hard on the algorithm until they found the right one.

- -

I think what they ended up using (and I hope someone will correct me, because I am not very confident about this) was the `longest common subsequence' method. In the LCS problem, you have two sequences of items:

- -
a b c d f g h j q z
-a b c d e f g i j k r x y z
-
- -

and you want to find the longest sequence of items that is present in both original sequences in the same order. That is, you want to find a new sequence S which can be obtained from the first sequence by deleting some items, and from the second sequence by deleting other items. You also want S to be as long as possible. In this case S is:

- -
a b c d f g j z
-
- -

From there it's only a small step to get diff-like output:

- -
e   h i   k   q r x y
-+   - +   +   - + + +
- -

This module solves the LCS problem. It also includes a canned function to generate diff-like output.

- -

It might seem from the example above that the LCS of two sequences is always pretty obvious, but that's not always the case, especially when the two sequences have many repeated elements. For example, consider

- -
a x b y c z p d q
-a b c a x b y c z
-
- -

A naive approach might start by matching up the a and b that appear at the beginning of each sequence, like this:

- -
a x b y c         z p d q
-a   b   c a b y c z
-
- -

This finds the common subsequence +a b c z+. But actually, the LCS is +a x b y c z+:

- -
      a x b y c z p d q
-a b c a x b y c z
-
- -
- -
- - -
-
-

Constants

-
-
-
BalancedCallbacks -

This callback object implements the default set of callback events, which only returns the event itself. Note that finished_a and finished_b are not implemented – I haven't yet figured out where they would be useful.

- -

Note that this is intended to be called as is, e.g.,

- -
Diff::LCS.LCS(seq1, seq2, Diff::LCS::DefaultCallbacks)
-
-
SequenceCallbacks -

This callback object implements the default set of callback events, which only returns the event itself. Note that finished_a and finished_b are not implemented – I haven't yet figured out where they would be useful.

- -

Note that this is intended to be called as is, e.g.,

- -
Diff::LCS.LCS(seq1, seq2, Diff::LCS::DefaultCallbacks)
-
-
VERSION -
-
-
- - - -
-
-

Public Class Methods

-
- -
-
- LCS(seq1, seq2, &block) -
- -
- - -
- - -
- Alias for: lcs -
-
- -
-
- callbacks_for(callbacks) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 52
-def self.callbacks_for(callbacks)
-  callbacks.new rescue callbacks
-end
-
-
- - -
- -
-
- diff(seq1, seq2, callbacks = nil, &block) - click to toggle source -
- -
-

diff computes the smallest set of additions and deletions necessary to turn the first sequence into the second, and returns a description of these changes.

- -

See Diff::LCS::DiffCallbacks for the default behaviour. An alternate behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a Class argument is provided for callbacks, diff will attempt to initialise it. If the callbacks object (possibly initialised) responds to finish, it will be called.

- -
-
# File lib/diff/lcs.rb, line 168
-def diff(seq1, seq2, callbacks = nil, &block) # :yields diff changes:
-  diff_traversal(:diff, seq1, seq2, callbacks || Diff::LCS::DiffCallbacks, &block)
-end
-
-
- - -
- -
-
- lcs(seq1, seq2, &block) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs.rb, line 144
-def lcs(seq1, seq2, &block) #:yields seq1[i] for each matched:
-  matches = Diff::LCS::Internals.lcs(seq1, seq2)
-  ret = []
-  string = seq1.kind_of? String
-  matches.each_with_index do |_e, i|
-    next if matches[i].nil?
-
-    v = string ? seq1[i, 1] : seq1[i]
-    v = block[v] if block
-    ret << v
-  end
-  ret
-end
-
-
- -
- Also aliased as: LCS -
- -
- -
-
- patch(src, patchset, direction = nil) - click to toggle source -
- -
-

Applies a patchset to the sequence src according to the direction (:patch or :unpatch), producing a new sequence.

- -

If the direction is not specified, Diff::LCS::patch will attempt to discover the direction of the patchset.

- -

A patchset can be considered to apply forward (:patch) if the following expression is true:

- -
patch(s1, diff(s1, s2)) -> s2
- -

A patchset can be considered to apply backward (:unpatch) if the following expression is true:

- -
patch(s2, diff(s1, s2)) -> s1
- -

If the patchset contains no changes, the src value will be returned as either src.dup or src. A patchset can be deemed as having no changes if the following predicate returns true:

- -
patchset.empty? or
-  patchset.flatten(1).all? { |change| change.unchanged? }
-
- -

Patchsets

- -

A patchset is always an enumerable sequence of changes, hunks of changes, or a mix of the two. A hunk of changes is an enumerable sequence of changes:

- -
[ # patchset
-  # change
-  [ # hunk
-    # change
-  ]
-]
-
- -

The patch method accepts patchsets that are enumerable sequences containing either Diff::LCS::Change objects (or a subclass) or the array representations of those objects. Prior to application, array representations of Diff::LCS::Change objects will be reified.

- -
-
# File lib/diff/lcs.rb, line 624
-def patch(src, patchset, direction = nil)
-  # Normalize the patchset.
-  has_changes, patchset = Diff::LCS::Internals.analyze_patchset(patchset)
-
-  return src.respond_to?(:dup) ? src.dup : src unless has_changes
-
-  string = src.kind_of?(String)
-  # Start with a new empty type of the source's class
-  res = src.class.new
-
-  direction ||= Diff::LCS::Internals.intuit_diff_direction(src, patchset)
-
-  ai = bj = 0
-
-  patch_map = PATCH_MAP[direction]
-
-  patchset.each do |change|
-    # Both Change and ContextChange support #action
-    action = patch_map[change.action]
-
-    case change
-    when Diff::LCS::ContextChange
-      case direction
-      when :patch
-        el = change.new_element
-        op = change.old_position
-        np = change.new_position
-      when :unpatch
-        el = change.old_element
-        op = change.new_position
-        np = change.old_position
-      end
-
-      case action
-      when '-' # Remove details from the old string
-        while ai < op
-          res << (string ? src[ai, 1] : src[ai])
-          ai += 1
-          bj += 1
-        end
-        ai += 1
-      when '+'
-        while bj < np
-          res << (string ? src[ai, 1] : src[ai])
-          ai += 1
-          bj += 1
-        end
-
-        res << el
-        bj += 1
-      when '='
-        # This only appears in sdiff output with the SDiff callback.
-        # Therefore, we only need to worry about dealing with a single
-        # element.
-        res << el
-
-        ai += 1
-        bj += 1
-      when '!'
-        while ai < op
-          res << (string ? src[ai, 1] : src[ai])
-          ai += 1
-          bj += 1
-        end
-
-        bj += 1
-        ai += 1
-
-        res << el
-      end
-    when Diff::LCS::Change
-      case action
-      when '-'
-        while ai < change.position
-          res << (string ? src[ai, 1] : src[ai])
-          ai += 1
-          bj += 1
-        end
-        ai += 1
-      when '+'
-        while bj < change.position
-          res << (string ? src[ai, 1] : src[ai])
-          ai += 1
-          bj += 1
-        end
-
-        bj += 1
-
-        res << change.element
-      end
-    end
-  end
-
-  while ai < src.size
-    res << (string ? src[ai, 1] : src[ai])
-    ai += 1
-    bj += 1
-  end
-
-  res
-end
-
-
- - -
- -
-
- patch!(src, patchset) - click to toggle source -
- -
-

Given a set of patchset, convert the current version to the next version. Does no auto-discovery.

- -
-
# File lib/diff/lcs.rb, line 734
-def patch!(src, patchset)
-  patch(src, patchset, :patch)
-end
-
-
- - -
- -
-
- sdiff(seq1, seq2, callbacks = nil, &block) - click to toggle source -
- -
-

sdiff computes all necessary components to show two sequences and their minimized differences side by side, just like the Unix utility sdiff does:

- -
old        <     -
-same             same
-before     |     after
--          >     new
- -

See Diff::LCS::SDiffCallbacks for the default behaviour. An alternate behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a Class argument is provided for callbacks, diff will attempt to initialise it. If the callbacks object (possibly initialised) responds to finish, it will be called.

- -

Each element of a returned array is a Diff::LCS::ContextChange object, which can be implicitly converted to an array.

- -
Diff::LCS.sdiff(a, b).each do |action, (old_pos, old_element), (new_pos, new_element)|
-  case action
-  when '!'
-    # replace
-  when '-'
-    # delete
-  when '+'
-    # insert
-  end
-end
-
- -
-
# File lib/diff/lcs.rb, line 200
-def sdiff(seq1, seq2, callbacks = nil, &block) #:yields diff changes:
-  diff_traversal(:sdiff, seq1, seq2, callbacks || Diff::LCS::SDiffCallbacks, &block)
-end
-
-
- - -
- -
-
- traverse_balanced(seq1, seq2, callbacks = Diff::LCS::BalancedCallbacks) { |event| ... } - click to toggle source -
- -
-

traverse_balanced is an alternative to traverse_sequences. It uses a different algorithm to iterate through the entries in the computed longest common subsequence. Instead of viewing the changes as insertions or deletions from one of the sequences, traverse_balanced will report changes between the sequences.

- -

The arguments to traverse_balanced are the two sequences to traverse and a callback object, like this:

- -
traverse_balanced(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
-
- -

sdiff is implemented with traverse_balanced.

- -

Callback Methods

- -

Optional callback methods are emphasized.

-
callbacks#match -
-

Called when a and b are pointing to common elements in A and B.

-
callbacks#discard_a -
-

Called when a is pointing to an element not in B.

-
callbacks#discard_b -
-

Called when b is pointing to an element not in A.

-
callbacks#change -
-

Called when a and b are pointing to the same relative position, but A[a] and B[b] are not the same; a change has occurred.

-
- -

traverse_balanced might be a bit slower than traverse_sequences, noticable only while processing huge amounts of data.

- -

Algorithm

- -
a---+
-    v
-A = a b c e h j l m n p
-B = b c d e f j k l m r s t
-    ^
-b---+
- -

Matches

- -

If there are two arrows (a and b) pointing to elements of sequences A and B, the arrows will initially point to the first elements of their respective sequences. traverse_sequences will advance the arrows through the sequences one element at a time, calling a method on the user-specified callback object before each advance. It will advance the arrows in such a way that if there are elements A[i] and B[j] which are both equal and part of the longest common subsequence, there will be some moment during the execution of traverse_sequences when arrow a is pointing to A[i] and arrow b is pointing to B[j]. When this happens, traverse_sequences will call callbacks#match and then it will advance both arrows.

- -

Discards

- -

Otherwise, one of the arrows is pointing to an element of its sequence that is not part of the longest common subsequence. traverse_sequences will advance that arrow and will call callbacks#discard_a or callbacks#discard_b, depending on which arrow it advanced.

- -

Changes

- -

If both a and b point to elements that are not part of the longest common subsequence, then traverse_sequences will try to call callbacks#change and advance both arrows. If callbacks#change is not implemented, then callbacks#discard_a and callbacks#discard_b will be called in turn.

- -

The methods for callbacks#match, callbacks#discard_a, callbacks#discard_b, and callbacks#change are invoked with an event comprising the action (“=”, “+”, “-”, or “!”, respectively), the indicies i and j, and the elements A[i] and B[j]. Return values are discarded by traverse_balanced.

- -

Context

- -

Note that i and j may not be the same index position, even if a and b are considered to be pointing to matching or changed elements.

- -
-
# File lib/diff/lcs.rb, line 475
-def traverse_balanced(seq1, seq2, callbacks = Diff::LCS::BalancedCallbacks)
-  matches = Diff::LCS::Internals.lcs(seq1, seq2)
-  a_size = seq1.size
-  b_size = seq2.size
-  ai = bj = mb = 0
-  ma = -1
-  string = seq1.kind_of?(String)
-
-  # Process all the lines in the match vector.
-  loop do
-    # Find next match indices +ma+ and +mb+
-    loop do
-      ma += 1
-      break unless ma < matches.size and matches[ma].nil?
-    end
-
-    break if ma >= matches.size # end of matches?
-
-    mb = matches[ma]
-
-    # Change(seq2)
-    while (ai < ma) or (bj < mb)
-      ax = string ? seq1[ai, 1] : seq1[ai]
-      bx = string ? seq2[bj, 1] : seq2[bj]
-
-      case [(ai < ma), (bj < mb)]
-      when [true, true]
-        if callbacks.respond_to?(:change)
-          event = Diff::LCS::ContextChange.new('!', ai, ax, bj, bx)
-          event = yield event if block_given?
-          callbacks.change(event)
-          ai += 1
-        else
-          event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
-          event = yield event if block_given?
-          callbacks.discard_a(event)
-          ai += 1
-          ax = string ? seq1[ai, 1] : seq1[ai]
-          event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
-          event = yield event if block_given?
-          callbacks.discard_b(event)
-        end
-
-        bj += 1
-      when [true, false]
-        event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
-        event = yield event if block_given?
-        callbacks.discard_a(event)
-        ai += 1
-      when [false, true]
-        event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
-        event = yield event if block_given?
-        callbacks.discard_b(event)
-        bj += 1
-      end
-    end
-
-    # Match
-    ax = string ? seq1[ai, 1] : seq1[ai]
-    bx = string ? seq2[bj, 1] : seq2[bj]
-    event = Diff::LCS::ContextChange.new('=', ai, ax, bj, bx)
-    event = yield event if block_given?
-    callbacks.match(event)
-    ai += 1
-    bj += 1
-  end
-
-  while (ai < a_size) or (bj < b_size)
-    ax = string ? seq1[ai, 1] : seq1[ai]
-    bx = string ? seq2[bj, 1] : seq2[bj]
-
-    case [(ai < a_size), (bj < b_size)]
-    when [true, true]
-      if callbacks.respond_to?(:change)
-        event = Diff::LCS::ContextChange.new('!', ai, ax, bj, bx)
-        event = yield event if block_given?
-        callbacks.change(event)
-        ai += 1
-      else
-        event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
-        event = yield event if block_given?
-        callbacks.discard_a(event)
-        ai += 1
-        ax = string ? seq1[ai, 1] : seq1[ai]
-        event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
-        event = yield event if block_given?
-        callbacks.discard_b(event)
-      end
-
-      bj += 1
-    when [true, false]
-      event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
-      event = yield event if block_given?
-      callbacks.discard_a(event)
-      ai += 1
-    when [false, true]
-      event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
-      event = yield event if block_given?
-      callbacks.discard_b(event)
-      bj += 1
-    end
-  end
-end
-
-
- - -
- -
-
- traverse_sequences(seq1, seq2, callbacks = Diff::LCS::SequenceCallbacks) { |event| ... } - click to toggle source -
- -
-

traverse_sequences is the most general facility provided by this module; diff and lcs are implemented as calls to it.

- -

The arguments to traverse_sequences are the two sequences to traverse, and a callback object, like this:

- -
traverse_sequences(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
-
- -

Callback Methods

- -

Optional callback methods are emphasized.

-
callbacks#match -
-

Called when a and b are pointing to common elements in A and B.

-
callbacks#discard_a -
-

Called when a is pointing to an element not in B.

-
callbacks#discard_b -
-

Called when b is pointing to an element not in A.

-
callbacks#finished_a -
-

Called when a has reached the end of sequence A.

-
callbacks#finished_b -
-

Called when b has reached the end of sequence B.

-
- -

Algorithm

- -
a---+
-    v
-A = a b c e h j l m n p
-B = b c d e f j k l m r s t
-    ^
-b---+
- -

If there are two arrows (a and b) pointing to elements of sequences A and B, the arrows will initially point to the first elements of their respective sequences. traverse_sequences will advance the arrows through the sequences one element at a time, calling a method on the user-specified callback object before each advance. It will advance the arrows in such a way that if there are elements A[i] and B[j] which are both equal and part of the longest common subsequence, there will be some moment during the execution of traverse_sequences when arrow a is pointing to A[i] and arrow b is pointing to B[j]. When this happens, traverse_sequences will call callbacks#match and then it will advance both arrows.

- -

Otherwise, one of the arrows is pointing to an element of its sequence that is not part of the longest common subsequence. traverse_sequences will advance that arrow and will call callbacks#discard_a or callbacks#discard_b, depending on which arrow it advanced. If both arrows point to elements that are not part of the longest common subsequence, then traverse_sequences will advance arrow a and call the appropriate callback, then it will advance arrow b and call the appropriate callback.

- -

The methods for callbacks#match, callbacks#discard_a, and callbacks#discard_b are invoked with an event comprising the action (“=”, “+”, or “-”, respectively), the indicies i and j, and the elements A[i] and B[j]. Return values are discarded by traverse_sequences.

- -

End of Sequences

- -

If arrow a reaches the end of its sequence before arrow b does, traverse_sequence will try to call callbacks#finished_a with the last index and element of A (A[-1]) and the current index and element of B (B[j]). If callbacks#finished_a does not exist, then callbacks#discard_b will be called on each element of B until the end of the sequence is reached (the call will be done with A[-1] and B[j] for each element).

- -

If b reaches the end of B before a reaches the end of A, callbacks#finished_b will be called with the current index and element of A (A[i]) and the last index and element of B (A[-1]). Again, if callbacks#finished_b does not exist on the callback object, then callbacks#discard_a will be called on each element of A until the end of the sequence is reached (A[i] and B[-1]).

- -

There is a chance that one additional callbacks#discard_a or callbacks#discard_b will be called after the end of the sequence is reached, if a has not yet reached the end of A or b has not yet reached the end of B.

- -
-
# File lib/diff/lcs.rb, line 285
-def traverse_sequences(seq1, seq2, callbacks = Diff::LCS::SequenceCallbacks) #:yields change events:
-  callbacks ||= Diff::LCS::SequenceCallbacks
-  matches = Diff::LCS::Internals.lcs(seq1, seq2)
-
-  run_finished_a = run_finished_b = false
-  string = seq1.kind_of?(String)
-
-  a_size = seq1.size
-  b_size = seq2.size
-  ai = bj = 0
-
-  matches.each do |b_line|
-    if b_line.nil?
-      unless seq1[ai].nil?
-        ax = string ? seq1[ai, 1] : seq1[ai]
-        bx = string ? seq2[bj, 1] : seq2[bj]
-
-        event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
-        event = yield event if block_given?
-        callbacks.discard_a(event)
-      end
-    else
-      ax = string ? seq1[ai, 1] : seq1[ai]
-
-      loop do
-        break unless bj < b_line
-
-        bx = string ? seq2[bj, 1] : seq2[bj]
-        event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
-        event = yield event if block_given?
-        callbacks.discard_b(event)
-        bj += 1
-      end
-      bx = string ? seq2[bj, 1] : seq2[bj]
-      event = Diff::LCS::ContextChange.new('=', ai, ax, bj, bx)
-      event = yield event if block_given?
-      callbacks.match(event)
-      bj += 1
-    end
-    ai += 1
-  end
-
-  # The last entry (if any) processed was a match. +ai+ and +bj+ point just
-  # past the last matching lines in their sequences.
-  while (ai < a_size) or (bj < b_size)
-    # last A?
-    if ai == a_size and bj < b_size
-      if callbacks.respond_to?(:finished_a) and !run_finished_a
-        ax = string ? seq1[-1, 1] : seq1[-1]
-        bx = string ? seq2[bj, 1] : seq2[bj]
-        event = Diff::LCS::ContextChange.new('>', (a_size - 1), ax, bj, bx)
-        event = yield event if block_given?
-        callbacks.finished_a(event)
-        run_finished_a = true
-      else
-        ax = string ? seq1[ai, 1] : seq1[ai]
-        loop do
-          bx = string ? seq2[bj, 1] : seq2[bj]
-          event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
-          event = yield event if block_given?
-          callbacks.discard_b(event)
-          bj += 1
-          break unless bj < b_size
-        end
-      end
-    end
-
-    # last B?
-    if bj == b_size and ai < a_size
-      if callbacks.respond_to?(:finished_b) and !run_finished_b
-        ax = string ? seq1[ai, 1] : seq1[ai]
-        bx = string ? seq2[-1, 1] : seq2[-1]
-        event = Diff::LCS::ContextChange.new('<', ai, ax, (b_size - 1), bx)
-        event = yield event if block_given?
-        callbacks.finished_b(event)
-        run_finished_b = true
-      else
-        bx = string ? seq2[bj, 1] : seq2[bj]
-        loop do
-          ax = string ? seq1[ai, 1] : seq1[ai]
-          event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
-          event = yield event if block_given?
-          callbacks.discard_a(event)
-          ai += 1
-          break unless bj < b_size
-        end
-      end
-    end
-
-    if ai < a_size
-      ax = string ? seq1[ai, 1] : seq1[ai]
-      bx = string ? seq2[bj, 1] : seq2[bj]
-      event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
-      event = yield event if block_given?
-      callbacks.discard_a(event)
-      ai += 1
-    end
-
-    if bj < b_size
-      ax = string ? seq1[ai, 1] : seq1[ai]
-      bx = string ? seq2[bj, 1] : seq2[bj]
-      event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
-      event = yield event if block_given?
-      callbacks.discard_b(event)
-      bj += 1
-    end
-  end
-end
-
-
- - -
- -
-
- unpatch!(src, patchset) - click to toggle source -
- -
-

Given a set of patchset, convert the current version to the prior version. Does no auto-discovery.

- -
-
# File lib/diff/lcs.rb, line 728
-def unpatch!(src, patchset)
-  patch(src, patchset, :unpatch)
-end
-
-
- - -
- -
- -
-
-

Public Instance Methods

-
- -
-
- diff(other, callbacks = nil, &block) - click to toggle source -
- -
-

Returns the difference set between self and other. See Diff::LCS#diff.

- -
-
# File lib/diff/lcs.rb, line 75
-def diff(other, callbacks = nil, &block)
-  Diff::LCS.diff(self, other, callbacks, &block)
-end
-
-
- - -
- -
-
- lcs(other, &block) - click to toggle source -
- -
-

Returns an Array containing the longest common subsequence(s) between self and other. See Diff::LCS#lcs.

- -
lcs = seq1.lcs(seq2)
-
- -

A note when using objects: Diff::LCS only works properly when each object can be used as a key in a Hash, which typically means that the objects must implement Object#eql? in a way that two identical values compare identically for key purposes. That is:

- -
O.new('a').eql?(O.new('a')) == true
-
- -
-
# File lib/diff/lcs.rb, line 70
-def lcs(other, &block) #:yields self[i] if there are matched subsequences:
-  Diff::LCS.lcs(self, other, &block)
-end
-
-
- - -
- -
-
- patch(patchset) - click to toggle source -
- -
-

Attempts to patch self with the provided patchset. A new sequence based on self and the patchset will be created. See Diff::LCS#patch. Attempts to autodiscover the direction of the patch.

- -
-
# File lib/diff/lcs.rb, line 101
-def patch(patchset)
-  Diff::LCS.patch(self, patchset)
-end
-
-
- -
- Also aliased as: unpatch -
- -
- -
-
- patch!(patchset) - click to toggle source -
- -
-

Attempts to patch self with the provided patchset. A new sequence based on self and the patchset will be created. See Diff::LCS#patch. Does no patch direction autodiscovery.

- -
-
# File lib/diff/lcs.rb, line 109
-def patch!(patchset)
-  Diff::LCS.patch!(self, patchset)
-end
-
-
- - -
- -
-
- patch_me(patchset) - click to toggle source -
- -
-

Attempts to patch self with the provided patchset, using patch!. If the sequence this is used on supports replace, the value of self will be replaced. See Diff::LCS#patch. Does no patch direction autodiscovery.

- -
-
# File lib/diff/lcs.rb, line 123
-def patch_me(patchset)
-  if respond_to? :replace
-    replace(patch!(patchset))
-  else
-    patch!(patchset)
-  end
-end
-
-
- - -
- -
-
- sdiff(other, callbacks = nil, &block) - click to toggle source -
- -
-

Returns the balanced (“side-by-side”) difference set between self and other. See Diff::LCS#sdiff.

- -
-
# File lib/diff/lcs.rb, line 81
-def sdiff(other, callbacks = nil, &block)
-  Diff::LCS.sdiff(self, other, callbacks, &block)
-end
-
-
- - -
- -
-
- traverse_balanced(other, callbacks = nil, &block) - click to toggle source -
- -
-

Traverses the discovered longest common subsequences between self and other using the alternate, balanced algorithm. See Diff::LCS#traverse_balanced.

- -
-
# File lib/diff/lcs.rb, line 94
-def traverse_balanced(other, callbacks = nil, &block)
-  Diff::LCS.traverse_balanced(self, other, callbacks || Diff::LCS::BalancedCallbacks, &block)
-end
-
-
- - -
- -
-
- traverse_sequences(other, callbacks = nil, &block) - click to toggle source -
- -
-

Traverses the discovered longest common subsequences between self and other. See Diff::LCS#traverse_sequences.

- -
-
# File lib/diff/lcs.rb, line 87
-def traverse_sequences(other, callbacks = nil, &block)
-  Diff::LCS.traverse_sequences(self, other, callbacks || Diff::LCS::SequenceCallbacks, &block)
-end
-
-
- - -
- -
-
- unpatch(patchset) -
- -
- - -
- - -
- Alias for: patch -
-
- -
-
- unpatch!(patchset) - click to toggle source -
- -
-

Attempts to unpatch self with the provided patchset. A new sequence based on self and the patchset will be created. See Diff::LCS#unpatch. Does no patch direction autodiscovery.

- -
-
# File lib/diff/lcs.rb, line 116
-def unpatch!(patchset)
-  Diff::LCS.unpatch!(self, patchset)
-end
-
-
- - -
- -
-
- unpatch_me(patchset) - click to toggle source -
- -
-

Attempts to unpatch self with the provided patchset, using unpatch!. If the sequence this is used on supports replace, the value of self will be replaced. See Diff::LCS#unpatch. Does no patch direction autodiscovery.

- -
-
# File lib/diff/lcs.rb, line 134
-def unpatch_me(patchset)
-  if respond_to? :replace
-    replace(unpatch!(patchset))
-  else
-    unpatch!(patchset)
-  end
-end
-
-
- - -
- -
- -
-
- - - - diff --git a/docs/LCS/Block.html b/docs/LCS/Block.html deleted file mode 100644 index b786ef6..0000000 --- a/docs/LCS/Block.html +++ /dev/null @@ -1,240 +0,0 @@ - - - - - - -class LCS::Block - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class LCS::Block -

- -
- -

A block is an operation removing, adding, or changing a group of items. Basically, this is just a list of changes, where each change adds or deletes a single item. Used by bin/ldiff.

- -
- -
- - - -
-
-

Attributes

-
- -
-
- changes[R] -
- -
- -
-
-
-
- insert[R] -
- -
- -
-
-
-
- remove[R] -
- -
- -
-
-
- - -
-
-

Public Class Methods

-
- -
-
- new(chunk) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/block.rb, line 9
-def initialize(chunk)
-  @changes = []
-  @insert = []
-  @remove = []
-
-  chunk.each do |item|
-    @changes << item
-    @remove << item if item.deleting?
-    @insert << item if item.adding?
-  end
-end
-
-
- - -
- -
- -
-
-

Public Instance Methods

-
- -
-
- diff_size() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/block.rb, line 21
-def diff_size
-  @insert.size - @remove.size
-end
-
-
- - -
- -
-
- op() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/block.rb, line 25
-def op
-  case [@remove.empty?, @insert.empty?]
-  when [false, false]
-    '!'
-  when [false, true]
-    '-'
-  when [true, false]
-    '+'
-  else # [true, true]
-    '^'
-  end
-end
-
-
- - -
- -
- -
-
- - - - diff --git a/docs/LCS/Change.html b/docs/LCS/Change.html deleted file mode 100644 index c714eea..0000000 --- a/docs/LCS/Change.html +++ /dev/null @@ -1,500 +0,0 @@ - - - - - - -class LCS::Change - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class LCS::Change -

- -
- -

Represents a simplistic (non-contextual) change. Represents the removal or addition of an element from either the old or the new sequenced enumerable.

- -
- -
- - -
-
-

Constants

-
-
-
IntClass -
-
VALID_ACTIONS -

The only actions valid for changes are '+' (add), '-' (delete), '=' (no change), '!' (changed), '<' (tail changes from first sequence), or '>' (tail changes from second sequence). The last two ('<>') are only found with Diff::LCS::diff and Diff::LCS::sdiff.

-
-
- -
-
-

Attributes

-
- -
-
- action[R] -
- -
-

Returns the action this Change represents.

-
-
-
-
- element[R] -
- -
-

Returns the sequence element of the Change.

-
-
-
-
- position[R] -
- -
-

Returns the position of the Change.

-
-
-
- - -
-
-

Public Class Methods

-
- -
-
- from_a(arr) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 44
-def self.from_a(arr)
-  arr = arr.flatten(1)
-  case arr.size
-  when 5
-    Diff::LCS::ContextChange.new(*(arr[0...5]))
-  when 3
-    Diff::LCS::Change.new(*(arr[0...3]))
-  else
-    fail 'Invalid change array format provided.'
-  end
-end
-
-
- - -
- -
-
- new(*args) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 27
-def initialize(*args)
-  @action, @position, @element = *args
-
-  fail "Invalid Change Action '#{@action}'" unless Diff::LCS::Change.valid_action?(@action)
-  fail 'Invalid Position Type' unless @position.kind_of? IntClass
-end
-
-
- - -
- -
-
- valid_action?(action) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 15
-def self.valid_action?(action)
-  VALID_ACTIONS.include? action
-end
-
-
- - -
- -
- -
-
-

Public Instance Methods

-
- -
-
- <=>(other) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 65
-def <=>(other)
-  r = action <=> other.action
-  r = position <=> other.position if r.zero?
-  r = element <=> other.element if r.zero?
-  r
-end
-
-
- - -
- -
-
- ==(other) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 58
-def ==(other)
-  (self.class == other.class) and
-    (action == other.action) and
-    (position == other.position) and
-    (element == other.element)
-end
-
-
- - -
- -
-
- adding?() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 72
-def adding?
-  @action == '+'
-end
-
-
- - -
- -
-
- changed?() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 84
-def changed?
-  @action == '!'
-end
-
-
- - -
- -
-
- deleting?() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 76
-def deleting?
-  @action == '-'
-end
-
-
- - -
- -
-
- finished_a?() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 88
-def finished_a?
-  @action == '>'
-end
-
-
- - -
- -
-
- finished_b?() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 92
-def finished_b?
-  @action == '<'
-end
-
-
- - -
- -
-
- inspect(*_args) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 34
-def inspect(*_args)
-  "#<#{self.class}: #{to_a.inspect}>"
-end
-
-
- - -
- -
-
- to_a() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 38
-def to_a
-  [@action, @position, @element]
-end
-
-
- -
- Also aliased as: to_ary -
- -
- -
-
- to_ary() -
- -
- - -
- - -
- Alias for: to_a -
-
- -
-
- unchanged?() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 80
-def unchanged?
-  @action == '='
-end
-
-
- - -
- -
- -
-
- - - - diff --git a/docs/LCS/ContextChange.html b/docs/LCS/ContextChange.html deleted file mode 100644 index b9b279c..0000000 --- a/docs/LCS/ContextChange.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - -class LCS::ContextChange - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class LCS::ContextChange -

- -
- -

Represents a contextual change. Contains the position and values of the elements in the old and the new sequenced enumerables as well as the action taken.

- -
- -
- - - -
-
-

Attributes

-
- -
-
- new_element[R] -
- -
-

Returns the new element being changed.

-
-
-
-
- new_position[R] -
- -
-

Returns the new position being changed.

-
-
-
-
- old_element[R] -
- -
-

Returns the old element being changed.

-
-
-
-
- old_position[R] -
- -
-

Returns the old position being changed.

-
-
-
- - -
-
-

Public Class Methods

-
- -
-
- from_a(arr) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 132
-def self.from_a(arr)
-  Diff::LCS::Change.from_a(arr)
-end
-
-
- - -
- -
-
- new(*args) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 114
-def initialize(*args)
-  @action, @old_position, @old_element, @new_position, @new_element = *args
-
-  fail "Invalid Change Action '#{@action}'" unless Diff::LCS::Change.valid_action?(@action)
-  fail 'Invalid (Old) Position Type' unless @old_position.nil? or @old_position.kind_of? IntClass
-  fail 'Invalid (New) Position Type' unless @new_position.nil? or @new_position.kind_of? IntClass
-end
-
-
- - -
- -
-
- simplify(event) - click to toggle source -
- -
-

Simplifies a context change for use in some diff callbacks. '<' actions are converted to '-' and '>' actions are converted to '+'.

- -
-
# File lib/diff/lcs/change.rb, line 138
-def self.simplify(event)
-  ea = event.to_a
-
-  case ea[0]
-  when '-'
-    ea[2][1] = nil
-  when '<'
-    ea[0] = '-'
-    ea[2][1] = nil
-  when '+'
-    ea[1][1] = nil
-  when '>'
-    ea[0] = '+'
-    ea[1][1] = nil
-  end
-
-  Diff::LCS::ContextChange.from_a(ea)
-end
-
-
- - -
- -
- -
-
-

Public Instance Methods

-
- -
-
- <=>(other) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 166
-def <=>(other)
-  r = @action <=> other.action
-  r = @old_position <=> other.old_position if r.zero?
-  r = @new_position <=> other.new_position if r.zero?
-  r = @old_element <=> other.old_element if r.zero?
-  r = @new_element <=> other.new_element if r.zero?
-  r
-end
-
-
- - -
- -
-
- ==(other) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 157
-def ==(other)
-  (self.class == other.class) and
-    (@action == other.action) and
-    (@old_position == other.old_position) and
-    (@new_position == other.new_position) and
-    (@old_element == other.old_element) and
-    (@new_element == other.new_element)
-end
-
-
- - -
- -
-
- to_a() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/change.rb, line 122
-def to_a
-  [
-    @action,
-    [@old_position, @old_element],
-    [@new_position, @new_element]
-  ]
-end
-
-
- -
- Also aliased as: to_ary -
- -
- -
-
- to_ary() -
- -
- - -
- - -
- Alias for: to_a -
-
- -
- -
-
- - - - diff --git a/docs/LCS/ContextDiffCallbacks.html b/docs/LCS/ContextDiffCallbacks.html deleted file mode 100644 index 2a1345b..0000000 --- a/docs/LCS/ContextDiffCallbacks.html +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - -class LCS::ContextDiffCallbacks - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class LCS::ContextDiffCallbacks -

- -
- -

This will produce a compound array of contextual diff change objects. Each element in the diffs array is a “hunk” array, where each element in each “hunk” array is a single change. Each change is a Diff::LCS::ContextChange that contains both the old index and new index values for the change. The “hunk” provides the full context for the changes. Both old and new objects will be presented for changed objects. nil will be substituted for a discarded object.

- -
seq1 = %w(a b c e h j l m n p)
-seq2 = %w(b c d e f j k l m r s t)
-
-diffs = Diff::LCS.diff(seq1, seq2, Diff::LCS::ContextDiffCallbacks)
-  # This example shows a simplified array format.
-  # [ [ [ '-', [  0, 'a' ], [  0, nil ] ] ],   # 1
-  #   [ [ '+', [  3, nil ], [  2, 'd' ] ] ],   # 2
-  #   [ [ '-', [  4, 'h' ], [  4, nil ] ],     # 3
-  #     [ '+', [  5, nil ], [  4, 'f' ] ] ],
-  #   [ [ '+', [  6, nil ], [  6, 'k' ] ] ],   # 4
-  #   [ [ '-', [  8, 'n' ], [  9, nil ] ],     # 5
-  #     [ '+', [  9, nil ], [  9, 'r' ] ],
-  #     [ '-', [  9, 'p' ], [ 10, nil ] ],
-  #     [ '+', [ 10, nil ], [ 10, 's' ] ],
-  #     [ '+', [ 10, nil ], [ 11, 't' ] ] ] ]
-
- -

The five hunks shown are comprised of individual changes; if there is a related set of changes, they are still shown individually.

- -

This callback can also be used with Diff::LCS#sdiff, which will produce results like:

- -
diffs = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextCallbacks)
-  # This example shows a simplified array format.
-  # [ [ [ "-", [  0, "a" ], [  0, nil ] ] ],  # 1
-  #   [ [ "+", [  3, nil ], [  2, "d" ] ] ],  # 2
-  #   [ [ "!", [  4, "h" ], [  4, "f" ] ] ],  # 3
-  #   [ [ "+", [  6, nil ], [  6, "k" ] ] ],  # 4
-  #   [ [ "!", [  8, "n" ], [  9, "r" ] ],    # 5
-  #     [ "!", [  9, "p" ], [ 10, "s" ] ],
-  #     [ "+", [ 10, nil ], [ 11, "t" ] ] ] ]
-
- -

The five hunks are still present, but are significantly shorter in total presentation, because changed items are shown as changes (“!”) instead of potentially “mismatched” pairs of additions and deletions.

- -

The result of this operation is similar to that of Diff::LCS::SDiffCallbacks. They may be compared as:

- -
s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
-c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
-
-s == c # -> true
-
- -

Use

- -

This callback object must be initialised and can be used by the Diff::LCS#diff or Diff::LCS#sdiff methods.

- -
cbo = Diff::LCS::ContextDiffCallbacks.new
-Diff::LCS.LCS(seq1, seq2, cbo)
-cbo.finish
-
- -

Note that the call to finish is absolutely necessary, or the last set of changes will not be visible. Alternatively, can be used as:

- -
cbo = Diff::LCS::ContextDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
-
- -

The necessary finish call will be made.

- -

Simplified Array Format

- -

The simplified array format used in the example above can be obtained with:

- -
require 'pp'
-pp diffs.map { |e| e.map { |f| f.to_a } }
-
- -
- -
- - - - - -
-
-

Public Instance Methods

-
- -
-
- change(event) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 232
-def change(event)
-  @hunk << Diff::LCS::ContextChange.simplify(event)
-end
-
-
- - -
- -
-
- discard_a(event) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 224
-def discard_a(event)
-  @hunk << Diff::LCS::ContextChange.simplify(event)
-end
-
-
- - -
- -
-
- discard_b(event) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 228
-def discard_b(event)
-  @hunk << Diff::LCS::ContextChange.simplify(event)
-end
-
-
- - -
- -
- -
-
- - - - diff --git a/docs/LCS/DefaultCallbacks.html b/docs/LCS/DefaultCallbacks.html deleted file mode 100644 index a63bb94..0000000 --- a/docs/LCS/DefaultCallbacks.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - -class LCS::SequenceCallbacks - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class LCS::SequenceCallbacks -

- -
- -

This callback object implements the default set of callback events, which only returns the event itself. Note that finished_a and finished_b are not implemented – I haven't yet figured out where they would be useful.

- -

Note that this is intended to be called as is, e.g.,

- -
Diff::LCS.LCS(seq1, seq2, Diff::LCS::DefaultCallbacks)
-
- -
- -
- - - - - -
-
-

Public Class Methods

-
- -
-
- change(event) - click to toggle source -
- -
-

Called when both the old and new values have changed.

- -
-
# File lib/diff/lcs/callbacks.rb, line 32
-def change(event)
-  event
-end
-
-
- - -
- -
-
- discard_a(event) - click to toggle source -
- -
-

Called when the old value is discarded in favour of the new value.

- -
-
# File lib/diff/lcs/callbacks.rb, line 22
-def discard_a(event)
-  event
-end
-
-
- - -
- -
-
- discard_b(event) - click to toggle source -
- -
-

Called when the new value is discarded in favour of the old value.

- -
-
# File lib/diff/lcs/callbacks.rb, line 27
-def discard_b(event)
-  event
-end
-
-
- - -
- -
-
- match(event) - click to toggle source -
- -
-

Called when two items match.

- -
-
# File lib/diff/lcs/callbacks.rb, line 17
-def match(event)
-  event
-end
-
-
- - -
- -
- -
-
- - - - diff --git a/docs/LCS/DiffCallbacks.html b/docs/LCS/DiffCallbacks.html deleted file mode 100644 index d82b399..0000000 --- a/docs/LCS/DiffCallbacks.html +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - -class LCS::DiffCallbacks - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class LCS::DiffCallbacks -

- -
- -

This will produce a compound array of simple diff change objects. Each element in the diffs array is a hunk or hunk array, where each element in each hunk array is a single Change object representing the addition or removal of a single element from one of the two tested sequences. The hunk provides the full context for the changes.

- -
diffs = Diff::LCS.diff(seq1, seq2)
-  # This example shows a simplified array format.
-  # [ [ [ '-',  0, 'a' ] ],   # 1
-  #   [ [ '+',  2, 'd' ] ],   # 2
-  #   [ [ '-',  4, 'h' ],     # 3
-  #     [ '+',  4, 'f' ] ],
-  #   [ [ '+',  6, 'k' ] ],   # 4
-  #   [ [ '-',  8, 'n' ],     # 5
-  #     [ '-',  9, 'p' ],
-  #     [ '+',  9, 'r' ],
-  #     [ '+', 10, 's' ],
-  #     [ '+', 11, 't' ] ] ]
-
- -

There are five hunks here. The first hunk says that the a at position 0 of the first sequence should be deleted ('-'). The second hunk says that the d at position 2 of the second sequence should be inserted ('+'). The third hunk says that the h at position 4 of the first sequence should be removed and replaced with the f from position 4 of the second sequence. The other two hunks are described similarly.

- -

Use

- -

This callback object must be initialised and is used by the Diff::LCS#diff method.

- -
cbo = Diff::LCS::DiffCallbacks.new
-Diff::LCS.LCS(seq1, seq2, cbo)
-cbo.finish
-
- -

Note that the call to finish is absolutely necessary, or the last set of changes will not be visible. Alternatively, can be used as:

- -
cbo = Diff::LCS::DiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
-
- -

The necessary finish call will be made.

- -

Simplified Array Format

- -

The simplified array format used in the example above can be obtained with:

- -
require 'pp'
-pp diffs.map { |e| e.map { |f| f.to_a } }
-
- -
- -
- - - -
-
-

Attributes

-
- -
-
- diffs[R] -
- -
-

Returns the difference set collected during the diff process.

-
-
-
- - -
-
-

Public Class Methods

-
- -
-
- new() { |self| ... } - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 110
-def initialize # :yields self:
-  @hunk = []
-  @diffs = []
-
-  return unless block_given?
-
-  begin
-    yield self
-  ensure
-    finish
-  end
-end
-
-
- - -
- -
- -
-
-

Public Instance Methods

-
- -
-
- discard_a(event) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 133
-def discard_a(event)
-  @hunk << Diff::LCS::Change.new('-', event.old_position, event.old_element)
-end
-
-
- - -
- -
-
- discard_b(event) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 137
-def discard_b(event)
-  @hunk << Diff::LCS::Change.new('+', event.new_position, event.new_element)
-end
-
-
- - -
- -
-
- finish() - click to toggle source -
- -
-

Finalizes the diff process. If an unprocessed hunk still exists, then it is appended to the diff list.

- -
-
# File lib/diff/lcs/callbacks.rb, line 125
-def finish
-  finish_hunk
-end
-
-
- - -
- -
-
- match(_event) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 129
-def match(_event)
-  finish_hunk
-end
-
-
- - -
- -
- -
-
- - - - diff --git a/docs/LCS/HTMLDiff.html b/docs/LCS/HTMLDiff.html deleted file mode 100644 index 19314fc..0000000 --- a/docs/LCS/HTMLDiff.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - -class LCS::HTMLDiff - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class LCS::HTMLDiff -

- -
- -

Produce a simple HTML diff view.

- -
- -
- - -
-
-

Constants

-
-
-
DEFAULT_CSS -
-
DEFAULT_OPTIONS -
-
-
- -
-
-

Attributes

-
- -
-
- options[R] -
- -
- -
-
-
- - -
-
-

Public Class Methods

-
- -
-
- new(left, right, options = nil) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/htmldiff.rb, line 90
-def initialize(left, right, options = nil)
-  @left     = left
-  @right    = right
-  @options  = options
-
-  @options = DEFAULT_OPTIONS.dup if @options.nil?
-end
-
-
- - -
- -
- -
-
-

Public Instance Methods

-
- -
-
- run() - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/htmldiff.rb, line 112
-  def run
-    verify_options
-
-    if @options[:expand_tabs].positive? && self.class.can_expand_tabs
-      formatter = Text::Format.new
-      formatter.tabstop = @options[:expand_tabs]
-
-      @left.map! do |line| formatter.expand(line.chomp) end
-      @right.map! do |line| formatter.expand(line.chomp) end
-    end
-
-    @left.map! do |line| CGI.escapeHTML(line.chomp) end
-    @right.map! do |line| CGI.escapeHTML(line.chomp) end
-
-    @options[:output] << <<-OUTPUT
-<html>
-  <head>
-    <title>#{@options[:title]}</title>
-    <style type="text/css">
-    #{@options[:css]}
-    </style>
-  </head>
-  <body>
-    <h1>#{@options[:title]}</h1>
-    <p>Legend: <span class="only_a">Only in Old</span>&nbsp;
-    <span class="only_b">Only in New</span></p>
-    <div class="diff">
-    OUTPUT
-
-    callbacks = Callbacks.new(@options[:output])
-    Diff::LCS.traverse_sequences(@left, @right, callbacks)
-
-    @options[:output] << <<-OUTPUT
-    </div>
-  </body>
-</html>
-    OUTPUT
-  end
-
-
- - -
- -
- -
-
- - - - diff --git a/docs/LCS/Hunk.html b/docs/LCS/Hunk.html deleted file mode 100644 index 0a22329..0000000 --- a/docs/LCS/Hunk.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - - -class LCS::Hunk - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class LCS::Hunk -

- -
- -

A Hunk is a group of Blocks which overlap because of the context surrounding each block. (So if we're not using context, every hunk will contain one block.) Used in the diff program (bin/ldiff).

- -
- -
- - - -
-
-

Attributes

-
- -
-
- blocks[R] -
- -
- -
-
-
-
- end_new[R] -
- -
- -
-
-
-
- end_old[R] -
- -
- -
-
-
-
- file_length_difference[R] -
- -
- -
-
-
-
- flag_context[RW] -
- -
-

Change the “start” and “end” fields to note that context should be added to this hunk.

-
-
-
-
- start_new[R] -
- -
- -
-
-
-
- start_old[R] -
- -
- -
-
-
- - -
-
-

Public Class Methods

-
- -
-
- new(data_old, data_new, piece, flag_context, file_length_difference) - click to toggle source -
- -
-

Create a hunk using references to both the old and new data, as well as the piece of data.

- -
-
# File lib/diff/lcs/hunk.rb, line 16
-def initialize(data_old, data_new, piece, flag_context, file_length_difference)
-  # At first, a hunk will have just one Block in it
-  @blocks = [Diff::LCS::Block.new(piece)]
-
-  if @blocks[0].remove.empty? && @blocks[0].insert.empty?
-    fail "Cannot build a hunk from #{piece.inspect}; has no add or remove actions"
-  end
-
-  if String.method_defined?(:encoding)
-    @preferred_data_encoding = data_old.fetch(0, data_new.fetch(0, '')).encoding
-  end
-
-  @data_old = data_old
-  @data_new = data_new
-
-  before = after = file_length_difference
-  after += @blocks[0].diff_size
-  @file_length_difference = after # The caller must get this manually
-  @max_diff_size = @blocks.map { |e| e.diff_size.abs }.max
-
-
-  # Save the start & end of each array. If the array doesn't exist (e.g.,
-  # we're only adding items in this block), then figure out the line number
-  # based on the line number of the other file and the current difference in
-  # file lengths.
-  if @blocks[0].remove.empty?
-    a1 = a2 = nil
-  else
-    a1 = @blocks[0].remove[0].position
-    a2 = @blocks[0].remove[-1].position
-  end
-
-  if @blocks[0].insert.empty?
-    b1 = b2 = nil
-  else
-    b1 = @blocks[0].insert[0].position
-    b2 = @blocks[0].insert[-1].position
-  end
-
-  @start_old = a1 || (b1 - before)
-  @start_new = b1 || (a1 + before)
-  @end_old   = a2 || (b2 - after)
-  @end_new   = b2 || (a2 + after)
-
-  self.flag_context = flag_context
-end
-
-
- - -
- -
- -
-
-

Public Instance Methods

-
- -
-
- diff(format, last = false) - click to toggle source -
- -
-

Returns a diff string based on a format.

- -
-
# File lib/diff/lcs/hunk.rb, line 116
-def diff(format, last = false)
-  case format
-  when :old
-    old_diff(last)
-  when :unified
-    unified_diff(last)
-  when :context
-    context_diff(last)
-  when :ed
-    self
-  when :reverse_ed, :ed_finish
-    ed_diff(format, last)
-  else
-    fail "Unknown diff format #{format}."
-  end
-end
-
-
- - -
- -
-
- merge(hunk) - click to toggle source -
- -
-

Merges this hunk and the provided hunk together if they overlap. Returns a truthy value so that if there is no overlap, you can know the merge was skipped.

- -
-
# File lib/diff/lcs/hunk.rb, line 98
-def merge(hunk)
-  return unless overlaps?(hunk)
-
-  @start_old = hunk.start_old
-  @start_new = hunk.start_new
-  blocks.unshift(*hunk.blocks)
-end
-
-
- -
- Also aliased as: unshift -
- -
- -
-
- missing_last_newline?(data) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/hunk.rb, line 326
-def missing_last_newline?(data)
-  newline = encode("\n")
-
-  if data[-2]
-    data[-2].end_with?(newline) && !data[-1].end_with?(newline)
-  elsif data[-1]
-    !data[-1].end_with?(newline)
-  else
-    true
-  end
-end
-
-
- - -
- -
-
- overlaps?(hunk) - click to toggle source -
- -
-

Determines whether there is an overlap between this hunk and the provided hunk. This will be true if the difference between the two hunks start or end positions is within one position of each other.

- -
-
# File lib/diff/lcs/hunk.rb, line 110
-def overlaps?(hunk)
-  hunk and (((@start_old - hunk.end_old) <= 1) or
-            ((@start_new - hunk.end_new) <= 1))
-end
-
-
- - -
- -
-
- unshift(hunk) -
- -
- - -
- - -
- Alias for: merge -
-
- -
- -
-
- - - - diff --git a/docs/LCS/SDiffCallbacks.html b/docs/LCS/SDiffCallbacks.html deleted file mode 100644 index 46b385f..0000000 --- a/docs/LCS/SDiffCallbacks.html +++ /dev/null @@ -1,312 +0,0 @@ - - - - - - -class LCS::SDiffCallbacks - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class LCS::SDiffCallbacks -

- -
- -

This will produce a simple array of diff change objects. Each element in the diffs array is a single ContextChange. In the set of diffs provided by SDiffCallbacks, both old and new objects will be presented for both changed <strong>and unchanged</strong> objects. nil will be substituted for a discarded object.

- -

The diffset produced by this callback, when provided to Diff::LCS#sdiff, will compute and display the necessary components to show two sequences and their minimized differences side by side, just like the Unix utility sdiff.

- -
same             same
-before     |     after
-old        <     -
--          >     new
-
-seq1 = %w(a b c e h j l m n p)
-seq2 = %w(b c d e f j k l m r s t)
-
-diffs = Diff::LCS.sdiff(seq1, seq2)
-  # This example shows a simplified array format.
-  # [ [ "-", [  0, "a"], [  0, nil ] ],
-  #   [ "=", [  1, "b"], [  0, "b" ] ],
-  #   [ "=", [  2, "c"], [  1, "c" ] ],
-  #   [ "+", [  3, nil], [  2, "d" ] ],
-  #   [ "=", [  3, "e"], [  3, "e" ] ],
-  #   [ "!", [  4, "h"], [  4, "f" ] ],
-  #   [ "=", [  5, "j"], [  5, "j" ] ],
-  #   [ "+", [  6, nil], [  6, "k" ] ],
-  #   [ "=", [  6, "l"], [  7, "l" ] ],
-  #   [ "=", [  7, "m"], [  8, "m" ] ],
-  #   [ "!", [  8, "n"], [  9, "r" ] ],
-  #   [ "!", [  9, "p"], [ 10, "s" ] ],
-  #   [ "+", [ 10, nil], [ 11, "t" ] ] ]
- -

The result of this operation is similar to that of Diff::LCS::ContextDiffCallbacks. They may be compared as:

- -
s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
-c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
-
-s == c # -> true
-
- -

Use

- -

This callback object must be initialised and is used by the Diff::LCS#sdiff method.

- -
cbo = Diff::LCS::SDiffCallbacks.new
-Diff::LCS.LCS(seq1, seq2, cbo)
-
- -

As with the other initialisable callback objects, Diff::LCS::SDiffCallbacks can be initialised with a block. As there is no “fininishing” to be done, this has no effect on the state of the object.

- -
cbo = Diff::LCS::SDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
-
- -

Simplified Array Format

- -

The simplified array format used in the example above can be obtained with:

- -
require 'pp'
-pp diffs.map { |e| e.to_a }
-
- -
- -
- - - -
-
-

Attributes

-
- -
-
- diffs[R] -
- -
-

Returns the difference set collected during the diff process.

-
-
-
- - -
-
-

Public Class Methods

-
- -
-
- new() { |self| ... } - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 305
-def initialize #:yields self:
-  @diffs = []
-  yield self if block_given?
-end
-
-
- - -
- -
- -
-
-

Public Instance Methods

-
- -
-
- change(event) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 322
-def change(event)
-  @diffs << Diff::LCS::ContextChange.simplify(event)
-end
-
-
- - -
- -
-
- discard_a(event) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 314
-def discard_a(event)
-  @diffs << Diff::LCS::ContextChange.simplify(event)
-end
-
-
- - -
- -
-
- discard_b(event) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 318
-def discard_b(event)
-  @diffs << Diff::LCS::ContextChange.simplify(event)
-end
-
-
- - -
- -
-
- match(event) - click to toggle source -
- -
- - -
-
# File lib/diff/lcs/callbacks.rb, line 310
-def match(event)
-  @diffs << Diff::LCS::ContextChange.simplify(event)
-end
-
-
- - -
- -
- -
-
- - - - diff --git a/docs/License_md.html b/docs/License_md.html deleted file mode 100644 index c0fd8e4..0000000 --- a/docs/License_md.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - -License - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
- -

== License

- -

This software is available under three licenses: the GNU GPL version 2 (or at your option, a later version), the Perl Artistic license, or the MIT license. Note that my preference for licensing is the MIT license, but Algorithm::Diff was dually originally licensed with the Perl Artistic and the GNU GPL (“the same terms as Perl itself”) and given that the Ruby implementation originally hewed pretty closely to the Perl version, I must maintain the additional licensing terms.

-
  • -

    Copyright 2004–2013 Austin Ziegler.

    -
  • -

    Adapted from Algorithm::Diff (Perl) by Ned Konz and a Smalltalk version by Mario I. Wolczko.

    -
- -

=== MIT License

- -

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

- -

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

- -

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

- -

=== Perl Artistic License (version 2) See the file docs/artistic.txt in the main distribution.

- -

=== GNU GPL version 2 See the file docs/COPYING.txt in the main distribution.

- -
- - - - - diff --git a/docs/Manifest_txt.html b/docs/Manifest_txt.html deleted file mode 100644 index 4f36eee..0000000 --- a/docs/Manifest_txt.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - -Manifest - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
- -

.rspec Code-of-Conduct.md Contributing.md History.md License.md Manifest.txt README.rdoc Rakefile bin/htmldiff bin/ldiff docs/COPYING.txt docs/artistic.txt lib/diff-lcs.rb lib/diff/lcs.rb lib/diff/lcs/array.rb lib/diff/lcs/backports.rb lib/diff/lcs/block.rb lib/diff/lcs/callbacks.rb lib/diff/lcs/change.rb lib/diff/lcs/htmldiff.rb lib/diff/lcs/hunk.rb lib/diff/lcs/internals.rb lib/diff/lcs/ldiff.rb lib/diff/lcs/string.rb spec/change_spec.rb spec/diff_spec.rb spec/fixtures/aX spec/fixtures/bXaX spec/fixtures/ds1.csv spec/fixtures/ds2.csv spec/fixtures/ldiff/output.diff spec/fixtures/ldiff/output.diff-c spec/fixtures/ldiff/output.diff-e spec/fixtures/ldiff/output.diff-f spec/fixtures/ldiff/output.diff-u spec/fixtures/ldiff/output.diff.chef spec/fixtures/ldiff/output.diff.chef-c spec/fixtures/ldiff/output.diff.chef-e spec/fixtures/ldiff/output.diff.chef-f spec/fixtures/ldiff/output.diff.chef-u spec/fixtures/ldiff/output.diff.chef2 spec/fixtures/ldiff/output.diff.chef2-c spec/fixtures/ldiff/output.diff.chef2-d spec/fixtures/ldiff/output.diff.chef2-e spec/fixtures/ldiff/output.diff.chef2-f spec/fixtures/ldiff/output.diff.chef2-u spec/fixtures/new-chef spec/fixtures/new-chef2 spec/fixtures/old-chef spec/fixtures/old-chef2 spec/hunk_spec.rb spec/issues_spec.rb spec/lcs_spec.rb spec/ldiff_spec.rb spec/patch_spec.rb spec/sdiff_spec.rb spec/spec_helper.rb spec/traverse_balanced_spec.rb spec/traverse_sequences_spec.rb

- -
- - - - - diff --git a/docs/README_rdoc.html b/docs/README_rdoc.html deleted file mode 100644 index 8b2478e..0000000 --- a/docs/README_rdoc.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - -README - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
- -

Diff::LCS

-
home -
-

github.com/halostatue/diff-lcs

-
code -
-

github.com/halostatue/diff-lcs

-
bugs -
-

github.com/halostatue/diff-lcs/issues

-
rdoc -
-

rubydoc.info/github/halostatue/diff-lcs

-
continuous integration -
-

-
- -

Description

- -

Diff::LCS computes the difference between two Enumerable sequences using the McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities to create a simple HTML diff output format and a standard diff-like tool.

- -

This is release 1.4.3, providing a simple extension that allows for Diff::LCS::Change objects to be treated implicitly as arrays and fixes a number of formatting issues.

- -

Ruby versions below 2.5 are soft-deprecated, which means that older versions are no longer part of the CI test suite. If any changes have been introduced that break those versions, bug reports and patches will be accepted, but it will be up to the reporter to verify any fixes prior to release. The next major release will completely break compatibility.

- -

Synopsis

- -

Using this module is quite simple. By default, Diff::LCS does not extend objects with the Diff::LCS interface, but will be called as if it were a function:

- -
require 'diff/lcs'
-
-seq1 = %w(a b c e h j l m n p)
-seq2 = %w(b c d e f j k l m r s t)
-
-lcs = Diff::LCS.LCS(seq1, seq2)
-diffs = Diff::LCS.diff(seq1, seq2)
-sdiff = Diff::LCS.sdiff(seq1, seq2)
-seq = Diff::LCS.traverse_sequences(seq1, seq2, callback_obj)
-bal = Diff::LCS.traverse_balanced(seq1, seq2, callback_obj)
-seq2 == Diff::LCS.patch!(seq1, diffs)
-seq1 == Diff::LCS.unpatch!(seq2, diffs)
-seq2 == Diff::LCS.patch!(seq1, sdiff)
-seq1 == Diff::LCS.unpatch!(seq2, sdiff)
-
- -

Objects can be extended with Diff::LCS:

- -
seq1.extend(Diff::LCS)
-lcs = seq1.lcs(seq2)
-diffs = seq1.diff(seq2)
-sdiff = seq1.sdiff(seq2)
-seq = seq1.traverse_sequences(seq2, callback_obj)
-bal = seq1.traverse_balanced(seq2, callback_obj)
-seq2 == seq1.patch!(diffs)
-seq1 == seq2.unpatch!(diffs)
-seq2 == seq1.patch!(sdiff)
-seq1 == seq2.unpatch!(sdiff)
-
- -

By requiring 'diff/lcs/array' or 'diff/lcs/string', Array or String will be extended for use this way.

- -

Note that Diff::LCS requires a sequenced enumerable container, which means that the order of enumeration is both predictable and consistent for the same set of data. While it is theoretically possible to generate a diff for an unordered hash, it will only be meaningful if the enumeration of the hashes is consistent. In general, this will mean that containers that behave like String or Array will perform best.

- -

History

- -

Diff::LCS is a port of Perl's Algorithm::Diff that uses the McIlroy-Hunt longest common subsequence (LCS) algorithm to compute intelligent differences between two sequenced enumerable containers. The implementation is based on Mario I. Wolczko's Smalltalk version 1.2 (1993) and Ned Konz's Perl version Algorithm::Diff 1.15. Diff::LCS#sdiff and Diff::LCS#traverse_balanced were originally written for the Perl version by Mike Schilli.

- -

The algorithm is described in A Fast Algorithm for Computing Longest Common Subsequences, CACM, vol.20, no.5, pp.350-353, May 1977, with a few minor improvements to improve the speed. A simplified description of the algorithm, originally written for the Perl version, was written by Mark-Jason Dominus.

- -
- - - - - diff --git a/docs/String.html b/docs/String.html deleted file mode 100644 index 18d26b9..0000000 --- a/docs/String.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -class String - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
-

- class String -

- -
- -
- -
- - - - - -
-
- - - - diff --git a/docs/created.rid b/docs/created.rid deleted file mode 100644 index 6ca4fff..0000000 --- a/docs/created.rid +++ /dev/null @@ -1,21 +0,0 @@ -Thu, 23 Dec 2021 00:51:29 -0500 -lib/diff/lcs/ldiff.rb Thu, 23 Dec 2021 00:51:24 -0500 -lib/diff/lcs/change.rb Thu, 23 Dec 2021 00:51:24 -0500 -lib/diff/lcs/string.rb Thu, 23 Dec 2021 00:51:24 -0500 -lib/diff/lcs/block.rb Thu, 23 Dec 2021 00:51:24 -0500 -lib/diff/lcs/array.rb Thu, 23 Dec 2021 00:51:24 -0500 -lib/diff/lcs/callbacks.rb Thu, 23 Dec 2021 00:51:24 -0500 -lib/diff/lcs/backports.rb Thu, 23 Dec 2021 00:51:24 -0500 -lib/diff/lcs/hunk.rb Thu, 23 Dec 2021 00:51:24 -0500 -lib/diff/lcs/internals.rb Thu, 23 Dec 2021 00:51:24 -0500 -lib/diff/lcs/htmldiff.rb Thu, 23 Dec 2021 00:51:24 -0500 -lib/diff/lcs.rb Thu, 23 Dec 2021 00:51:24 -0500 -lib/diff-lcs.rb Thu, 23 Dec 2021 00:51:24 -0500 -Code-of-Conduct.md Thu, 23 Dec 2021 00:51:24 -0500 -Contributing.md Thu, 23 Dec 2021 00:51:24 -0500 -History.md Thu, 23 Dec 2021 00:51:24 -0500 -License.md Thu, 23 Dec 2021 00:51:24 -0500 -Manifest.txt Thu, 23 Dec 2021 00:51:24 -0500 -README.rdoc Thu, 23 Dec 2021 00:51:24 -0500 -docs/COPYING.txt Thu, 23 Dec 2021 00:51:24 -0500 -docs/artistic.txt Thu, 23 Dec 2021 00:51:24 -0500 diff --git a/docs/css/fonts.css b/docs/css/fonts.css deleted file mode 100644 index 57302b5..0000000 --- a/docs/css/fonts.css +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), - * with Reserved Font Name "Source". All Rights Reserved. Source is a - * trademark of Adobe Systems Incorporated in the United States and/or other - * countries. - * - * This Font Software is licensed under the SIL Open Font License, Version - * 1.1. - * - * This license is copied below, and is also available with a FAQ at: - * http://scripts.sil.org/OFL - */ - -@font-face { - font-family: "Source Code Pro"; - font-style: normal; - font-weight: 400; - src: local("Source Code Pro"), - local("SourceCodePro-Regular"), - url("../fonts/SourceCodePro-Regular.ttf") format("truetype"); -} - -@font-face { - font-family: "Source Code Pro"; - font-style: normal; - font-weight: 700; - src: local("Source Code Pro Bold"), - local("SourceCodePro-Bold"), - url("../fonts/SourceCodePro-Bold.ttf") format("truetype"); -} - -/* - * Copyright (c) 2010, Łukasz Dziedzic (dziedzic@typoland.com), - * with Reserved Font Name Lato. - * - * This Font Software is licensed under the SIL Open Font License, Version - * 1.1. - * - * This license is copied below, and is also available with a FAQ at: - * http://scripts.sil.org/OFL - */ - -@font-face { - font-family: "Lato"; - font-style: normal; - font-weight: 300; - src: local("Lato Light"), - local("Lato-Light"), - url("../fonts/Lato-Light.ttf") format("truetype"); -} - -@font-face { - font-family: "Lato"; - font-style: italic; - font-weight: 300; - src: local("Lato Light Italic"), - local("Lato-LightItalic"), - url("../fonts/Lato-LightItalic.ttf") format("truetype"); -} - -@font-face { - font-family: "Lato"; - font-style: normal; - font-weight: 700; - src: local("Lato Regular"), - local("Lato-Regular"), - url("../fonts/Lato-Regular.ttf") format("truetype"); -} - -@font-face { - font-family: "Lato"; - font-style: italic; - font-weight: 700; - src: local("Lato Italic"), - local("Lato-Italic"), - url("../fonts/Lato-RegularItalic.ttf") format("truetype"); -} - -/* - * ----------------------------------------------------------- - * SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 - * ----------------------------------------------------------- - * - * PREAMBLE - * The goals of the Open Font License (OFL) are to stimulate worldwide - * development of collaborative font projects, to support the font creation - * efforts of academic and linguistic communities, and to provide a free and - * open framework in which fonts may be shared and improved in partnership - * with others. - * - * The OFL allows the licensed fonts to be used, studied, modified and - * redistributed freely as long as they are not sold by themselves. The - * fonts, including any derivative works, can be bundled, embedded, - * redistributed and/or sold with any software provided that any reserved - * names are not used by derivative works. The fonts and derivatives, - * however, cannot be released under any other type of license. The - * requirement for fonts to remain under this license does not apply - * to any document created using the fonts or their derivatives. - * - * DEFINITIONS - * "Font Software" refers to the set of files released by the Copyright - * Holder(s) under this license and clearly marked as such. This may - * include source files, build scripts and documentation. - * - * "Reserved Font Name" refers to any names specified as such after the - * copyright statement(s). - * - * "Original Version" refers to the collection of Font Software components as - * distributed by the Copyright Holder(s). - * - * "Modified Version" refers to any derivative made by adding to, deleting, - * or substituting -- in part or in whole -- any of the components of the - * Original Version, by changing formats or by porting the Font Software to a - * new environment. - * - * "Author" refers to any designer, engineer, programmer, technical - * writer or other person who contributed to the Font Software. - * - * PERMISSION & CONDITIONS - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of the Font Software, to use, study, copy, merge, embed, modify, - * redistribute, and sell modified and unmodified copies of the Font - * Software, subject to the following conditions: - * - * 1) Neither the Font Software nor any of its individual components, - * in Original or Modified Versions, may be sold by itself. - * - * 2) Original or Modified Versions of the Font Software may be bundled, - * redistributed and/or sold with any software, provided that each copy - * contains the above copyright notice and this license. These can be - * included either as stand-alone text files, human-readable headers or - * in the appropriate machine-readable metadata fields within text or - * binary files as long as those fields can be easily viewed by the user. - * - * 3) No Modified Version of the Font Software may use the Reserved Font - * Name(s) unless explicit written permission is granted by the corresponding - * Copyright Holder. This restriction only applies to the primary font name as - * presented to the users. - * - * 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font - * Software shall not be used to promote, endorse or advertise any - * Modified Version, except to acknowledge the contribution(s) of the - * Copyright Holder(s) and the Author(s) or with their explicit written - * permission. - * - * 5) The Font Software, modified or unmodified, in part or in whole, - * must be distributed entirely under this license, and must not be - * distributed under any other license. The requirement for fonts to - * remain under this license does not apply to any document created - * using the Font Software. - * - * TERMINATION - * This license becomes null and void if any of the above conditions are - * not met. - * - * DISCLAIMER - * THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT - * OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL - * DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM - * OTHER DEALINGS IN THE FONT SOFTWARE. - */ - diff --git a/docs/css/rdoc.css b/docs/css/rdoc.css deleted file mode 100644 index ebe2e93..0000000 --- a/docs/css/rdoc.css +++ /dev/null @@ -1,639 +0,0 @@ -/* - * "Darkfish" Rdoc CSS - * $Id: rdoc.css 54 2009-01-27 01:09:48Z deveiant $ - * - * Author: Michael Granger - * - */ - -/* vim: ft=css et sw=2 ts=2 sts=2 */ -/* Base Green is: #6C8C22 */ - -.hide { display: none !important; } - -* { padding: 0; margin: 0; } - -body { - background: #fafafa; - font-family: Lato, sans-serif; - font-weight: 300; -} - -h1 span, -h2 span, -h3 span, -h4 span, -h5 span, -h6 span { - position: relative; - - display: none; - padding-left: 1em; - line-height: 0; - vertical-align: baseline; - font-size: 10px; -} - -h1 span { top: -1.3em; } -h2 span { top: -1.2em; } -h3 span { top: -1.0em; } -h4 span { top: -0.8em; } -h5 span { top: -0.5em; } -h6 span { top: -0.5em; } - -h1:hover span, -h2:hover span, -h3:hover span, -h4:hover span, -h5:hover span, -h6:hover span { - display: inline; -} - -h1:target, -h2:target, -h3:target, -h4:target, -h5:target, -h6:target { - margin-left: -10px; - border-left: 10px solid #f1edba; -} - -:link, -:visited { - color: #6C8C22; - text-decoration: none; -} - -:link:hover, -:visited:hover { - border-bottom: 1px dotted #6C8C22; -} - -code, -pre { - font-family: "Source Code Pro", Monaco, monospace; - background-color: rgba(27,31,35,0.05); - padding: 0em 0.2em; - border-radius: 0.2em; -} - -table { - margin: 0; - border-spacing: 0; - border-collapse: collapse; -} - -table tr th, table tr td { - padding: 0.2em 0.4em; - border: 1px solid #ccc; -} - -table tr th { - background-color: #eceaed; -} - -table tr:nth-child(even) td { - background-color: #f5f4f6; -} - -/* @group Generic Classes */ - -.initially-hidden { - display: none; -} - -#search-field { - width: 98%; - background: white; - border: none; - height: 1.5em; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - text-align: left; -} -#search-field:focus { - background: #f1edba; -} -#search-field:-moz-placeholder, -#search-field::-webkit-input-placeholder { - font-weight: bold; - color: #666; -} - -.missing-docs { - font-size: 120%; - background: white url(../images/wrench_orange.png) no-repeat 4px center; - color: #ccc; - line-height: 2em; - border: 1px solid #d00; - opacity: 1; - padding-left: 20px; - text-indent: 24px; - letter-spacing: 3px; - font-weight: bold; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; -} - -.target-section { - border: 2px solid #dcce90; - border-left-width: 8px; - padding: 0 1em; - background: #fff3c2; -} - -/* @end */ - -/* @group Index Page, Standalone file pages */ -.table-of-contents ul { - margin: 1em; - list-style: none; -} - -.table-of-contents ul ul { - margin-top: 0.25em; -} - -.table-of-contents ul :link, -.table-of-contents ul :visited { - font-size: 16px; -} - -.table-of-contents li { - margin-bottom: 0.25em; -} - -.table-of-contents li .toc-toggle { - width: 16px; - height: 16px; - background: url(../images/add.png) no-repeat; -} - -.table-of-contents li .toc-toggle.open { - background: url(../images/delete.png) no-repeat; -} - -/* @end */ - -/* @group Top-Level Structure */ - -nav { - float: left; - width: 260px; - font-family: Helvetica, sans-serif; - font-size: 14px; - border-right: 1px solid #ccc; -} - -main { - display: block; - margin: 0 2em 5em 260px; - padding-left: 20px; - min-width: 340px; - font-size: 16px; -} - -main h1, -main h2, -main h3, -main h4, -main h5, -main h6 { - font-family: Helvetica, sans-serif; -} - -.table-of-contents main { - margin-left: 2em; -} - -#validator-badges { - clear: both; - margin: 1em 1em 2em; - font-size: smaller; -} - -/* @end */ - -/* @group navigation */ -nav { - margin-bottom: 1em; -} - -nav .nav-section { - margin-top: 2em; - border-top: 2px solid #aaa; - font-size: 90%; - overflow: hidden; -} - -nav h2 { - margin: 0; - padding: 2px 8px 2px 8px; - background-color: #e8e8e8; - color: #555; - font-size: 125%; - text-align: center; -} - -nav h3, -#table-of-contents-navigation { - margin: 0; - padding: 2px 8px 2px 8px; - text-align: right; - background-color: #e8e8e8; - color: #555; -} - -nav ul, -nav dl, -nav p { - padding: 4px 8px 0; - list-style: none; -} - -#project-navigation .nav-section { - margin: 0; - border-top: 0; -} - -#home-section h2 { - text-align: center; -} - -#table-of-contents-navigation { - font-size: 1.2em; - font-weight: bold; - text-align: center; -} - -#search-section { - margin-top: 0; - border-top: 0; -} - -#search-field-wrapper { - border-top: 1px solid #aaa; - border-bottom: 1px solid #aaa; - padding: 3px 8px; - background-color: #e8e8e8; - color: #555; -} - -ul.link-list li { - white-space: nowrap; - line-height: 1.4em; -} - -ul.link-list .type { - font-size: 8px; - text-transform: uppercase; - color: white; - background: #969696; - padding: 2px 4px; - -webkit-border-radius: 5px; -} - -dl.note-list dt { - float: left; - margin-right: 1em; -} - -.calls-super { - background: url(../images/arrow_up.png) no-repeat right center; -} - -/* @end */ - -/* @group Documentation Section */ -main { - color: #333; -} - -main > h1:first-child, -main > h2:first-child, -main > h3:first-child, -main > h4:first-child, -main > h5:first-child, -main > h6:first-child { - margin-top: 0px; -} - -main sup { - vertical-align: super; - font-size: 0.8em; -} - -/* The heading with the class name */ -main h1[class] { - margin-top: 0; - margin-bottom: 1em; - font-size: 2em; - color: #6C8C22; -} - -main h1 { - margin: 2em 0 0.5em; - font-size: 1.7em; -} - -main h2 { - margin: 2em 0 0.5em; - font-size: 1.5em; -} - -main h3 { - margin: 2em 0 0.5em; - font-size: 1.2em; -} - -main h4 { - margin: 2em 0 0.5em; - font-size: 1.1em; -} - -main h5 { - margin: 2em 0 0.5em; - font-size: 1em; -} - -main h6 { - margin: 2em 0 0.5em; - font-size: 1em; -} - -main p { - margin: 0 0 0.5em; - line-height: 1.4em; -} - -main pre { - margin: 1.2em 0.5em; - padding: 1em; - font-size: 0.8em; -} - -main hr { - margin: 1.5em 1em; - border: 2px solid #ddd; -} - -main blockquote { - margin: 0 2em 1.2em 1.2em; - padding-left: 0.5em; - border-left: 2px solid #ddd; -} - -main ol, -main ul { - margin: 1em 2em; -} - -main li > p { - margin-bottom: 0.5em; -} - -main dl { - margin: 1em 0.5em; -} - -main dt { - margin-bottom: 0.5em; - font-weight: bold; -} - -main dd { - margin: 0 1em 1em 0.5em; -} - -main header h2 { - margin-top: 2em; - border-width: 0; - border-top: 4px solid #bbb; - font-size: 130%; -} - -main header h3 { - margin: 2em 0 1.5em; - border-width: 0; - border-top: 3px solid #bbb; - font-size: 120%; -} - -.documentation-section-title { - position: relative; -} -.documentation-section-title .section-click-top { - position: absolute; - top: 6px; - left: 12px; - font-size: 10px; - color: #9b9877; - visibility: hidden; - padding-left: 0.5px; -} - -.documentation-section-title:hover .section-click-top { - visibility: visible; -} - -.constants-list > dl { - margin: 1em 0 2em; - border: 0; -} - -.constants-list > dl dt { - margin-bottom: 0.75em; - padding-left: 0; - font-family: "Source Code Pro", Monaco, monospace; - font-size: 110%; -} - -.constants-list > dl dt a { - color: inherit; -} - -.constants-list > dl dd { - margin: 0 0 2em 0; - padding: 0; - color: #666; -} - -.documentation-section h2 { - position: relative; -} - -.documentation-section h2 a { - position: absolute; - top: 8px; - right: 10px; - font-size: 12px; - color: #9b9877; - visibility: hidden; -} - -.documentation-section h2:hover a { - visibility: visible; -} - -/* @group Method Details */ - -main .method-source-code { - max-height: 0; - overflow: hidden; - transition-duration: 200ms; - transition-delay: 0ms; - transition-property: all; - transition-timing-function: ease-in-out; -} - -main .method-source-code.active-menu { - max-height: 100vh; -} - -main .method-description .method-calls-super { - color: #333; - font-weight: bold; -} - -main .method-detail { - margin-bottom: 2.5em; - cursor: pointer; -} - -main .method-detail:target { - margin-left: -10px; - border-left: 10px solid #f1edba; -} - -main .method-heading { - position: relative; - font-family: "Source Code Pro", Monaco, monospace; - font-size: 110%; - font-weight: bold; - color: #333; -} -main .method-heading :link, -main .method-heading :visited { - color: inherit; -} -main .method-click-advice { - position: absolute; - top: 2px; - right: 5px; - font-size: 12px; - color: #9b9877; - visibility: hidden; - padding-right: 20px; - line-height: 20px; - background: url(../images/zoom.png) no-repeat right top; -} -main .method-heading:hover .method-click-advice { - visibility: visible; -} - -main .method-alias .method-heading { - color: #666; -} - -main .method-description, -main .aliases { - margin-top: 0.75em; - color: #333; -} - -main .aliases { - padding-top: 4px; - font-style: italic; - cursor: default; -} -main .method-description ul { - margin-left: 1.5em; -} - -main #attribute-method-details .method-detail:hover { - background-color: transparent; - cursor: default; -} -main .attribute-access-type { - text-transform: uppercase; - padding: 0 1em; -} -/* @end */ - -/* @end */ - -/* @group Source Code */ - -pre { - margin: 0.5em 0; - border: 1px dashed #999; - padding: 0.5em; - background: #262626; - color: white; - overflow: auto; -} - -.ruby-constant { color: #7fffd4; background: transparent; } -.ruby-keyword { color: #00ffff; background: transparent; } -.ruby-ivar { color: #eedd82; background: transparent; } -.ruby-operator { color: #00ffee; background: transparent; } -.ruby-identifier { color: #ffdead; background: transparent; } -.ruby-node { color: #ffa07a; background: transparent; } -.ruby-comment { color: #dc0000; background: transparent; } -.ruby-regexp { color: #ffa07a; background: transparent; } -.ruby-value { color: #7fffd4; background: transparent; } - -/* @end */ - - -/* @group search results */ -#search-results { - font-family: Lato, sans-serif; - font-weight: 300; -} - -#search-results .search-match { - font-family: Helvetica, sans-serif; - font-weight: normal; -} - -#search-results .search-selected { - background: #e8e8e8; - border-bottom: 1px solid transparent; -} - -#search-results li { - list-style: none; - border-bottom: 1px solid #aaa; - margin-bottom: 0.5em; -} - -#search-results li:last-child { - border-bottom: none; - margin-bottom: 0; -} - -#search-results li p { - padding: 0; - margin: 0.5em; -} - -#search-results .search-namespace { - font-weight: bold; -} - -#search-results li em { - background: yellow; - font-style: normal; -} - -#search-results pre { - margin: 0.5em; - font-family: "Source Code Pro", Monaco, monospace; -} - -/* @end */ - diff --git a/docs/docs/COPYING_txt.html b/docs/docs/COPYING_txt.html deleted file mode 100644 index b0b2816..0000000 --- a/docs/docs/COPYING_txt.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - -COPYING - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
- -
                   GNU GENERAL PUBLIC LICENSE
-                      Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-                           Preamble
-
- The licenses for most software are designed to take away your
- -

freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software–to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.

- -
When we speak of free software, we are referring to freedom, not
- -

price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

- -
To protect your rights, we need to make restrictions that forbid
- -

anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

- -
For example, if you distribute copies of such a program, whether
- -

gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

- -
We protect your rights with two steps: (1) copyright the software, and
- -

(2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

- -
Also, for each author's protection and ours, we want to make certain
- -

that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

- -
Finally, any free program is threatened constantly by software
- -

patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

- -
The precise terms and conditions for copying, distribution and
- -

modification follow.

- -
                  GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains
- -

a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The “Program”, below, refers to any such program or work, and a “work based on the Program” means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term “modification”.) Each licensee is addressed as “you”.

- -

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

- -
1. You may copy and distribute verbatim copies of the Program's
- -

source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

- -

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

- -
2. You may modify your copy or copies of the Program or any portion
-
- -

of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

- -
a) You must cause the modified files to carry prominent notices
-stating that you changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in
-whole or in part contains or is derived from the Program or any
-part thereof, to be licensed as a whole at no charge to all third
-parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively
-when run, you must cause it, when started running for such
-interactive use in the most ordinary way, to print or display an
-announcement including an appropriate copyright notice and a
-notice that there is no warranty (or else, saying that you provide
-a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this
-License.  (Exception: if the Program itself is interactive but
-does not normally print such an announcement, your work based on
-the Program is not required to print an announcement.)
- -

These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

- -

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

- -

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

- -
3. You may copy and distribute the Program (or a work based on it,
- -

under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

- -
a) Accompany it with the complete corresponding machine-readable
-source code, which must be distributed under the terms of Sections
-1 and 2 above on a medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three
-years, to give any third party, for a charge no more than your
-cost of physically performing source distribution, a complete
-machine-readable copy of the corresponding source code, to be
-distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer
-to distribute corresponding source code.  (This alternative is
-allowed only for noncommercial distribution and only if you
-received the program in object code or executable form with such
-an offer, in accord with Subsection b above.)
- -

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

- -

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

- -
4. You may not copy, modify, sublicense, or distribute the Program
- -

except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

- -
5. You are not required to accept this License, since you have not
- -

signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

- -
6. Each time you redistribute the Program (or any work based on the
- -

Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

- -
7. If, as a consequence of a court judgment or allegation of patent
- -

infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

- -

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

- -

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

- -

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

- -
8. If the distribution and/or use of the Program is restricted in
- -

certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

- -
9. The Free Software Foundation may publish revised and/or new versions
- -

of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

- -

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and “any later version”, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

- -
10. If you wish to incorporate parts of the Program into other free
-
- -

programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

- -
                          NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
- -

FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

- -
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-
- -

WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

- -
                   END OF TERMS AND CONDITIONS
-
-          How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest
- -

possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

- -
To do so, attach the following notices to the program.  It is safest
- -

to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.

- -
<one line to give the program's name and a brief idea of what it does.>
-Copyright (C) <year>  <name of author>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- -

Also add information on how to contact you by electronic and paper mail.

- -

If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

- -
Gnomovision version 69, Copyright (C) year name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
- -

The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items–whatever suits your program.

- -

You should also get your employer (if you work as a programmer) or your school, if any, to sign a “copyright disclaimer” for the program, if necessary. Here is a sample; alter the names:

- -
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-`Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-<signature of Ty Coon>, 1 April 1989
-Ty Coon, President of Vice
- -

This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.

- -
- - - - - diff --git a/docs/docs/artistic_txt.html b/docs/docs/artistic_txt.html deleted file mode 100644 index 9410972..0000000 --- a/docs/docs/artistic_txt.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - -artistic - diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
- -

The “Artistic License”

- -
Preamble
-
- -

The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications.

- -

Definitions:

- -
"Package" refers to the collection of files distributed by the
-Copyright Holder, and derivatives of that collection of files
-created through textual modification.
-
-"Standard Version" refers to such a Package if it has not been
-modified, or has been modified in accordance with the wishes
-of the Copyright Holder as specified below.
-
-"Copyright Holder" is whoever is named in the copyright or
-copyrights for the package.
-
-"You" is you, if you're thinking about copying or distributing
-this Package.
-
-"Reasonable copying fee" is whatever you can justify on the
-basis of media cost, duplication charges, time of people involved,
-and so on.  (You will not be required to justify it to the
-Copyright Holder, but only to the computing community at large
-as a market that must bear the fee.)
-
-"Freely Available" means that no fee is charged for the item
-itself, though there may be fees involved in handling the item.
-It also means that recipients of the item may redistribute it
-under the same conditions they received it.
-
  1. -

    You may make and give away verbatim copies of the source form of the

    -
- -

Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers.

-
  1. -

    You may apply bug fixes, portability fixes and other modifications

    -
- -

derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version.

-
  1. -

    You may otherwise modify your copy of this Package in any way, provided

    -
- -

that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following:

- -
a) place your modifications in the Public Domain or otherwise make them
-Freely Available, such as by posting said modifications to Usenet or
-an equivalent medium, or placing the modifications on a major archive
-site such as uunet.uu.net, or by allowing the Copyright Holder to include
-your modifications in the Standard Version of the Package.
-
-b) use the modified Package only within your corporation or organization.
-
-c) rename any non-standard executables so the names do not conflict
-with standard executables, which must also be provided, and provide
-a separate manual page for each non-standard executable that clearly
-documents how it differs from the Standard Version.
-
-d) make other distribution arrangements with the Copyright Holder.
-
  1. -

    You may distribute the programs of this Package in object code or

    -
- -

executable form, provided that you do at least ONE of the following:

- -
a) distribute a Standard Version of the executables and library files,
-together with instructions (in the manual page or equivalent) on where
-to get the Standard Version.
-
-b) accompany the distribution with the machine-readable source of
-the Package with your modifications.
-
-c) give non-standard executables non-standard names, and clearly
-document the differences in manual pages (or equivalent), together
-with instructions on where to get the Standard Version.
-
-d) make other distribution arrangements with the Copyright Holder.
-
  1. -

    You may charge a reasonable copying fee for any distribution of this

    -
- -

Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded.

-
  1. -

    The scripts and library files supplied as input to or produced as

    -
- -

output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called “undump” or “unexec” methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package.

-
  1. -

    C subroutines (or comparably compiled subroutines in other

    -
- -

languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language.

-
  1. -

    Aggregation of this Package with a commercial distribution is always

    -
- -

permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package.

-
  1. -

    The name of the Copyright Holder may not be used to endorse or promote

    -
- -

products derived from this software without specific prior written permission.

-
  1. -

    THIS PACKAGE IS PROVIDED “AS IS” AND WITHOUT ANY EXPRESS OR

    -
- -

IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

- -
The End
-
- -
- - - - - diff --git a/docs/fonts/Lato-Light.ttf b/docs/fonts/Lato-Light.ttf deleted file mode 100644 index b49dd43..0000000 Binary files a/docs/fonts/Lato-Light.ttf and /dev/null differ diff --git a/docs/fonts/Lato-LightItalic.ttf b/docs/fonts/Lato-LightItalic.ttf deleted file mode 100644 index 7959fef..0000000 Binary files a/docs/fonts/Lato-LightItalic.ttf and /dev/null differ diff --git a/docs/fonts/Lato-Regular.ttf b/docs/fonts/Lato-Regular.ttf deleted file mode 100644 index 839cd58..0000000 Binary files a/docs/fonts/Lato-Regular.ttf and /dev/null differ diff --git a/docs/fonts/Lato-RegularItalic.ttf b/docs/fonts/Lato-RegularItalic.ttf deleted file mode 100644 index bababa0..0000000 Binary files a/docs/fonts/Lato-RegularItalic.ttf and /dev/null differ diff --git a/docs/fonts/SourceCodePro-Bold.ttf b/docs/fonts/SourceCodePro-Bold.ttf deleted file mode 100644 index 61e3090..0000000 Binary files a/docs/fonts/SourceCodePro-Bold.ttf and /dev/null differ diff --git a/docs/fonts/SourceCodePro-Regular.ttf b/docs/fonts/SourceCodePro-Regular.ttf deleted file mode 100644 index 85686d9..0000000 Binary files a/docs/fonts/SourceCodePro-Regular.ttf and /dev/null differ diff --git a/docs/images/add.png b/docs/images/add.png deleted file mode 100644 index 6332fef..0000000 Binary files a/docs/images/add.png and /dev/null differ diff --git a/docs/images/arrow_up.png b/docs/images/arrow_up.png deleted file mode 100644 index 1ebb193..0000000 Binary files a/docs/images/arrow_up.png and /dev/null differ diff --git a/docs/images/brick.png b/docs/images/brick.png deleted file mode 100644 index 7851cf3..0000000 Binary files a/docs/images/brick.png and /dev/null differ diff --git a/docs/images/brick_link.png b/docs/images/brick_link.png deleted file mode 100644 index 9ebf013..0000000 Binary files a/docs/images/brick_link.png and /dev/null differ diff --git a/docs/images/bug.png b/docs/images/bug.png deleted file mode 100644 index 2d5fb90..0000000 Binary files a/docs/images/bug.png and /dev/null differ diff --git a/docs/images/bullet_black.png b/docs/images/bullet_black.png deleted file mode 100644 index 5761970..0000000 Binary files a/docs/images/bullet_black.png and /dev/null differ diff --git a/docs/images/bullet_toggle_minus.png b/docs/images/bullet_toggle_minus.png deleted file mode 100644 index b47ce55..0000000 Binary files a/docs/images/bullet_toggle_minus.png and /dev/null differ diff --git a/docs/images/bullet_toggle_plus.png b/docs/images/bullet_toggle_plus.png deleted file mode 100644 index 9ab4a89..0000000 Binary files a/docs/images/bullet_toggle_plus.png and /dev/null differ diff --git a/docs/images/date.png b/docs/images/date.png deleted file mode 100644 index 783c833..0000000 Binary files a/docs/images/date.png and /dev/null differ diff --git a/docs/images/delete.png b/docs/images/delete.png deleted file mode 100644 index 08f2493..0000000 Binary files a/docs/images/delete.png and /dev/null differ diff --git a/docs/images/find.png b/docs/images/find.png deleted file mode 100644 index 1547479..0000000 Binary files a/docs/images/find.png and /dev/null differ diff --git a/docs/images/loadingAnimation.gif b/docs/images/loadingAnimation.gif deleted file mode 100644 index 82290f4..0000000 Binary files a/docs/images/loadingAnimation.gif and /dev/null differ diff --git a/docs/images/macFFBgHack.png b/docs/images/macFFBgHack.png deleted file mode 100644 index c6473b3..0000000 Binary files a/docs/images/macFFBgHack.png and /dev/null differ diff --git a/docs/images/package.png b/docs/images/package.png deleted file mode 100644 index da3c2a2..0000000 Binary files a/docs/images/package.png and /dev/null differ diff --git a/docs/images/page_green.png b/docs/images/page_green.png deleted file mode 100644 index de8e003..0000000 Binary files a/docs/images/page_green.png and /dev/null differ diff --git a/docs/images/page_white_text.png b/docs/images/page_white_text.png deleted file mode 100644 index 813f712..0000000 Binary files a/docs/images/page_white_text.png and /dev/null differ diff --git a/docs/images/page_white_width.png b/docs/images/page_white_width.png deleted file mode 100644 index 1eb8809..0000000 Binary files a/docs/images/page_white_width.png and /dev/null differ diff --git a/docs/images/plugin.png b/docs/images/plugin.png deleted file mode 100644 index 6187b15..0000000 Binary files a/docs/images/plugin.png and /dev/null differ diff --git a/docs/images/ruby.png b/docs/images/ruby.png deleted file mode 100644 index f763a16..0000000 Binary files a/docs/images/ruby.png and /dev/null differ diff --git a/docs/images/tag_blue.png b/docs/images/tag_blue.png deleted file mode 100644 index 3f02b5f..0000000 Binary files a/docs/images/tag_blue.png and /dev/null differ diff --git a/docs/images/tag_green.png b/docs/images/tag_green.png deleted file mode 100644 index 83ec984..0000000 Binary files a/docs/images/tag_green.png and /dev/null differ diff --git a/docs/images/transparent.png b/docs/images/transparent.png deleted file mode 100644 index d665e17..0000000 Binary files a/docs/images/transparent.png and /dev/null differ diff --git a/docs/images/wrench.png b/docs/images/wrench.png deleted file mode 100644 index 5c8213f..0000000 Binary files a/docs/images/wrench.png and /dev/null differ diff --git a/docs/images/wrench_orange.png b/docs/images/wrench_orange.png deleted file mode 100644 index 565a933..0000000 Binary files a/docs/images/wrench_orange.png and /dev/null differ diff --git a/docs/images/zoom.png b/docs/images/zoom.png deleted file mode 100644 index 908612e..0000000 Binary files a/docs/images/zoom.png and /dev/null differ diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 82b5b02..0000000 --- a/docs/index.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - -diff-lcs-1.5.0 Documentation - - - - - - - - - - - - - - - - -
- - -

Diff::LCS

-
home -
-

github.com/halostatue/diff-lcs

-
code -
-

github.com/halostatue/diff-lcs

-
bugs -
-

github.com/halostatue/diff-lcs/issues

-
rdoc -
-

rubydoc.info/github/halostatue/diff-lcs

-
continuous integration -
-

-
- -

Description

- -

Diff::LCS computes the difference between two Enumerable sequences using the McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities to create a simple HTML diff output format and a standard diff-like tool.

- -

This is release 1.4.3, providing a simple extension that allows for Diff::LCS::Change objects to be treated implicitly as arrays and fixes a number of formatting issues.

- -

Ruby versions below 2.5 are soft-deprecated, which means that older versions are no longer part of the CI test suite. If any changes have been introduced that break those versions, bug reports and patches will be accepted, but it will be up to the reporter to verify any fixes prior to release. The next major release will completely break compatibility.

- -

Synopsis

- -

Using this module is quite simple. By default, Diff::LCS does not extend objects with the Diff::LCS interface, but will be called as if it were a function:

- -
require 'diff/lcs'
-
-seq1 = %w(a b c e h j l m n p)
-seq2 = %w(b c d e f j k l m r s t)
-
-lcs = Diff::LCS.LCS(seq1, seq2)
-diffs = Diff::LCS.diff(seq1, seq2)
-sdiff = Diff::LCS.sdiff(seq1, seq2)
-seq = Diff::LCS.traverse_sequences(seq1, seq2, callback_obj)
-bal = Diff::LCS.traverse_balanced(seq1, seq2, callback_obj)
-seq2 == Diff::LCS.patch!(seq1, diffs)
-seq1 == Diff::LCS.unpatch!(seq2, diffs)
-seq2 == Diff::LCS.patch!(seq1, sdiff)
-seq1 == Diff::LCS.unpatch!(seq2, sdiff)
-
- -

Objects can be extended with Diff::LCS:

- -
seq1.extend(Diff::LCS)
-lcs = seq1.lcs(seq2)
-diffs = seq1.diff(seq2)
-sdiff = seq1.sdiff(seq2)
-seq = seq1.traverse_sequences(seq2, callback_obj)
-bal = seq1.traverse_balanced(seq2, callback_obj)
-seq2 == seq1.patch!(diffs)
-seq1 == seq2.unpatch!(diffs)
-seq2 == seq1.patch!(sdiff)
-seq1 == seq2.unpatch!(sdiff)
-
- -

By requiring 'diff/lcs/array' or 'diff/lcs/string', Array or String will be extended for use this way.

- -

Note that Diff::LCS requires a sequenced enumerable container, which means that the order of enumeration is both predictable and consistent for the same set of data. While it is theoretically possible to generate a diff for an unordered hash, it will only be meaningful if the enumeration of the hashes is consistent. In general, this will mean that containers that behave like String or Array will perform best.

- -

History

- -

Diff::LCS is a port of Perl's Algorithm::Diff that uses the McIlroy-Hunt longest common subsequence (LCS) algorithm to compute intelligent differences between two sequenced enumerable containers. The implementation is based on Mario I. Wolczko's Smalltalk version 1.2 (1993) and Ned Konz's Perl version Algorithm::Diff 1.15. Diff::LCS#sdiff and Diff::LCS#traverse_balanced were originally written for the Perl version by Mike Schilli.

- -

The algorithm is described in A Fast Algorithm for Computing Longest Common Subsequences, CACM, vol.20, no.5, pp.350-353, May 1977, with a few minor improvements to improve the speed. A simplified description of the algorithm, originally written for the Perl version, was written by Mark-Jason Dominus.

- -
- - - - diff --git a/docs/js/darkfish.js b/docs/js/darkfish.js deleted file mode 100644 index 111bbf8..0000000 --- a/docs/js/darkfish.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * - * Darkfish Page Functions - * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $ - * - * Author: Michael Granger - * - */ - -/* Provide console simulation for firebug-less environments */ -/* -if (!("console" in window) || !("firebug" in console)) { - var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", - "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; - - window.console = {}; - for (var i = 0; i < names.length; ++i) - window.console[names[i]] = function() {}; -}; -*/ - - -function showSource( e ) { - var target = e.target; - while (!target.classList.contains('method-detail')) { - target = target.parentNode; - } - if (typeof target !== "undefined" && target !== null) { - target = target.querySelector('.method-source-code'); - } - if (typeof target !== "undefined" && target !== null) { - target.classList.toggle('active-menu') - } -}; - -function hookSourceViews() { - document.querySelectorAll('.method-heading').forEach(function (codeObject) { - codeObject.addEventListener('click', showSource); - }); -}; - -function hookSearch() { - var input = document.querySelector('#search-field'); - var result = document.querySelector('#search-results'); - result.classList.remove("initially-hidden"); - - var search_section = document.querySelector('#search-section'); - search_section.classList.remove("initially-hidden"); - - var search = new Search(search_data, input, result); - - search.renderItem = function(result) { - var li = document.createElement('li'); - var html = ''; - - // TODO add relative path to - - - - - - - - - - - - -
-

Table of Contents - diff-lcs-1.5.0 Documentation

- -

Pages

- - -

Classes and Modules

- - -

Methods

- -
- - - - diff --git a/fonts/Lato-Light.ttf b/fonts/Lato-Light.ttf new file mode 100644 index 0000000..b49dd43 Binary files /dev/null and b/fonts/Lato-Light.ttf differ diff --git a/fonts/Lato-LightItalic.ttf b/fonts/Lato-LightItalic.ttf new file mode 100644 index 0000000..7959fef Binary files /dev/null and b/fonts/Lato-LightItalic.ttf differ diff --git a/fonts/Lato-Regular.ttf b/fonts/Lato-Regular.ttf new file mode 100644 index 0000000..839cd58 Binary files /dev/null and b/fonts/Lato-Regular.ttf differ diff --git a/fonts/Lato-RegularItalic.ttf b/fonts/Lato-RegularItalic.ttf new file mode 100644 index 0000000..bababa0 Binary files /dev/null and b/fonts/Lato-RegularItalic.ttf differ diff --git a/fonts/SourceCodePro-Bold.ttf b/fonts/SourceCodePro-Bold.ttf new file mode 100644 index 0000000..61e3090 Binary files /dev/null and b/fonts/SourceCodePro-Bold.ttf differ diff --git a/fonts/SourceCodePro-Regular.ttf b/fonts/SourceCodePro-Regular.ttf new file mode 100644 index 0000000..85686d9 Binary files /dev/null and b/fonts/SourceCodePro-Regular.ttf differ diff --git a/images/add.png b/images/add.png new file mode 100644 index 0000000..6332fef Binary files /dev/null and b/images/add.png differ diff --git a/images/arrow_up.png b/images/arrow_up.png new file mode 100644 index 0000000..1ebb193 Binary files /dev/null and b/images/arrow_up.png differ diff --git a/images/brick.png b/images/brick.png new file mode 100644 index 0000000..7851cf3 Binary files /dev/null and b/images/brick.png differ diff --git a/images/brick_link.png b/images/brick_link.png new file mode 100644 index 0000000..9ebf013 Binary files /dev/null and b/images/brick_link.png differ diff --git a/images/bug.png b/images/bug.png new file mode 100644 index 0000000..2d5fb90 Binary files /dev/null and b/images/bug.png differ diff --git a/images/bullet_black.png b/images/bullet_black.png new file mode 100644 index 0000000..5761970 Binary files /dev/null and b/images/bullet_black.png differ diff --git a/images/bullet_toggle_minus.png b/images/bullet_toggle_minus.png new file mode 100644 index 0000000..b47ce55 Binary files /dev/null and b/images/bullet_toggle_minus.png differ diff --git a/images/bullet_toggle_plus.png b/images/bullet_toggle_plus.png new file mode 100644 index 0000000..9ab4a89 Binary files /dev/null and b/images/bullet_toggle_plus.png differ diff --git a/images/date.png b/images/date.png new file mode 100644 index 0000000..783c833 Binary files /dev/null and b/images/date.png differ diff --git a/images/delete.png b/images/delete.png new file mode 100644 index 0000000..08f2493 Binary files /dev/null and b/images/delete.png differ diff --git a/images/find.png b/images/find.png new file mode 100644 index 0000000..1547479 Binary files /dev/null and b/images/find.png differ diff --git a/images/loadingAnimation.gif b/images/loadingAnimation.gif new file mode 100644 index 0000000..82290f4 Binary files /dev/null and b/images/loadingAnimation.gif differ diff --git a/images/macFFBgHack.png b/images/macFFBgHack.png new file mode 100644 index 0000000..c6473b3 Binary files /dev/null and b/images/macFFBgHack.png differ diff --git a/images/package.png b/images/package.png new file mode 100644 index 0000000..da3c2a2 Binary files /dev/null and b/images/package.png differ diff --git a/images/page_green.png b/images/page_green.png new file mode 100644 index 0000000..de8e003 Binary files /dev/null and b/images/page_green.png differ diff --git a/images/page_white_text.png b/images/page_white_text.png new file mode 100644 index 0000000..813f712 Binary files /dev/null and b/images/page_white_text.png differ diff --git a/images/page_white_width.png b/images/page_white_width.png new file mode 100644 index 0000000..1eb8809 Binary files /dev/null and b/images/page_white_width.png differ diff --git a/images/plugin.png b/images/plugin.png new file mode 100644 index 0000000..6187b15 Binary files /dev/null and b/images/plugin.png differ diff --git a/images/ruby.png b/images/ruby.png new file mode 100644 index 0000000..f763a16 Binary files /dev/null and b/images/ruby.png differ diff --git a/images/tag_blue.png b/images/tag_blue.png new file mode 100644 index 0000000..3f02b5f Binary files /dev/null and b/images/tag_blue.png differ diff --git a/images/tag_green.png b/images/tag_green.png new file mode 100644 index 0000000..83ec984 Binary files /dev/null and b/images/tag_green.png differ diff --git a/images/transparent.png b/images/transparent.png new file mode 100644 index 0000000..d665e17 Binary files /dev/null and b/images/transparent.png differ diff --git a/images/wrench.png b/images/wrench.png new file mode 100644 index 0000000..5c8213f Binary files /dev/null and b/images/wrench.png differ diff --git a/images/wrench_orange.png b/images/wrench_orange.png new file mode 100644 index 0000000..565a933 Binary files /dev/null and b/images/wrench_orange.png differ diff --git a/images/zoom.png b/images/zoom.png new file mode 100644 index 0000000..908612e Binary files /dev/null and b/images/zoom.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..82b5b02 --- /dev/null +++ b/index.html @@ -0,0 +1,184 @@ + + + + + + +diff-lcs-1.5.0 Documentation + + + + + + + + + + + + + + + + +
+ + +

Diff::LCS

+
home +
+

github.com/halostatue/diff-lcs

+
code +
+

github.com/halostatue/diff-lcs

+
bugs +
+

github.com/halostatue/diff-lcs/issues

+
rdoc +
+

rubydoc.info/github/halostatue/diff-lcs

+
continuous integration +
+

+
+ +

Description

+ +

Diff::LCS computes the difference between two Enumerable sequences using the McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities to create a simple HTML diff output format and a standard diff-like tool.

+ +

This is release 1.4.3, providing a simple extension that allows for Diff::LCS::Change objects to be treated implicitly as arrays and fixes a number of formatting issues.

+ +

Ruby versions below 2.5 are soft-deprecated, which means that older versions are no longer part of the CI test suite. If any changes have been introduced that break those versions, bug reports and patches will be accepted, but it will be up to the reporter to verify any fixes prior to release. The next major release will completely break compatibility.

+ +

Synopsis

+ +

Using this module is quite simple. By default, Diff::LCS does not extend objects with the Diff::LCS interface, but will be called as if it were a function:

+ +
require 'diff/lcs'
+
+seq1 = %w(a b c e h j l m n p)
+seq2 = %w(b c d e f j k l m r s t)
+
+lcs = Diff::LCS.LCS(seq1, seq2)
+diffs = Diff::LCS.diff(seq1, seq2)
+sdiff = Diff::LCS.sdiff(seq1, seq2)
+seq = Diff::LCS.traverse_sequences(seq1, seq2, callback_obj)
+bal = Diff::LCS.traverse_balanced(seq1, seq2, callback_obj)
+seq2 == Diff::LCS.patch!(seq1, diffs)
+seq1 == Diff::LCS.unpatch!(seq2, diffs)
+seq2 == Diff::LCS.patch!(seq1, sdiff)
+seq1 == Diff::LCS.unpatch!(seq2, sdiff)
+
+ +

Objects can be extended with Diff::LCS:

+ +
seq1.extend(Diff::LCS)
+lcs = seq1.lcs(seq2)
+diffs = seq1.diff(seq2)
+sdiff = seq1.sdiff(seq2)
+seq = seq1.traverse_sequences(seq2, callback_obj)
+bal = seq1.traverse_balanced(seq2, callback_obj)
+seq2 == seq1.patch!(diffs)
+seq1 == seq2.unpatch!(diffs)
+seq2 == seq1.patch!(sdiff)
+seq1 == seq2.unpatch!(sdiff)
+
+ +

By requiring 'diff/lcs/array' or 'diff/lcs/string', Array or String will be extended for use this way.

+ +

Note that Diff::LCS requires a sequenced enumerable container, which means that the order of enumeration is both predictable and consistent for the same set of data. While it is theoretically possible to generate a diff for an unordered hash, it will only be meaningful if the enumeration of the hashes is consistent. In general, this will mean that containers that behave like String or Array will perform best.

+ +

History

+ +

Diff::LCS is a port of Perl's Algorithm::Diff that uses the McIlroy-Hunt longest common subsequence (LCS) algorithm to compute intelligent differences between two sequenced enumerable containers. The implementation is based on Mario I. Wolczko's Smalltalk version 1.2 (1993) and Ned Konz's Perl version Algorithm::Diff 1.15. Diff::LCS#sdiff and Diff::LCS#traverse_balanced were originally written for the Perl version by Mike Schilli.

+ +

The algorithm is described in A Fast Algorithm for Computing Longest Common Subsequences, CACM, vol.20, no.5, pp.350-353, May 1977, with a few minor improvements to improve the speed. A simplified description of the algorithm, originally written for the Perl version, was written by Mark-Jason Dominus.

+ +
+ + + + diff --git a/js/darkfish.js b/js/darkfish.js new file mode 100644 index 0000000..111bbf8 --- /dev/null +++ b/js/darkfish.js @@ -0,0 +1,84 @@ +/** + * + * Darkfish Page Functions + * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $ + * + * Author: Michael Granger + * + */ + +/* Provide console simulation for firebug-less environments */ +/* +if (!("console" in window) || !("firebug" in console)) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", + "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; + + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +}; +*/ + + +function showSource( e ) { + var target = e.target; + while (!target.classList.contains('method-detail')) { + target = target.parentNode; + } + if (typeof target !== "undefined" && target !== null) { + target = target.querySelector('.method-source-code'); + } + if (typeof target !== "undefined" && target !== null) { + target.classList.toggle('active-menu') + } +}; + +function hookSourceViews() { + document.querySelectorAll('.method-heading').forEach(function (codeObject) { + codeObject.addEventListener('click', showSource); + }); +}; + +function hookSearch() { + var input = document.querySelector('#search-field'); + var result = document.querySelector('#search-results'); + result.classList.remove("initially-hidden"); + + var search_section = document.querySelector('#search-section'); + search_section.classList.remove("initially-hidden"); + + var search = new Search(search_data, input, result); + + search.renderItem = function(result) { + var li = document.createElement('li'); + var html = ''; + + // TODO add relative path to + + + + + + + + + + + + +
+

Table of Contents - diff-lcs-1.5.0 Documentation

+ +

Pages

+ + +

Classes and Modules

+ + +

Methods

+ +
+ + + + -- cgit v1.2.1