Class: JarTools::Diff::EntryIterator::AnalyzableEntry
- Inherits:
-
Object
- Object
- JarTools::Diff::EntryIterator::AnalyzableEntry
- Includes:
- Comparable
- Defined in:
- lib/jartools/diff.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #archive? ⇒ Boolean
-
#binary? ⇒ Boolean
This logic is odd, but it’s what grep does, apparently.
- #display_name ⇒ Object
- #extract ⇒ Object
-
#initialize(jarfile, path, container_files) ⇒ AnalyzableEntry
constructor
A new instance of AnalyzableEntry.
Constructor Details
#initialize(jarfile, path, container_files) ⇒ AnalyzableEntry
Returns a new instance of AnalyzableEntry.
115 116 117 118 119 |
# File 'lib/jartools/diff.rb', line 115 def initialize(jarfile, path, container_files) @jarfile = jarfile @path = path @container_files = container_files end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
113 114 115 |
# File 'lib/jartools/diff.rb', line 113 def path @path end |
Instance Method Details
#<=>(other) ⇒ Object
140 141 142 |
# File 'lib/jartools/diff.rb', line 140 def <=>(other) path <=> other.path end |
#archive? ⇒ Boolean
131 132 133 |
# File 'lib/jartools/diff.rb', line 131 def archive? path =~ /(zip|jar|war)$/ end |
#binary? ⇒ Boolean
This logic is odd, but it’s what grep does, apparently
136 137 138 |
# File 'lib/jartools/diff.rb', line 136 def binary? extract.contents.match("\000") end |
#display_name ⇒ Object
121 122 123 |
# File 'lib/jartools/diff.rb', line 121 def display_name (@container_files + [path]).join(" | ") end |
#extract ⇒ Object
125 126 127 128 129 |
# File 'lib/jartools/diff.rb', line 125 def extract @extract ||= Zip::ZipFile.open(@jarfile.readable_filename) do |z| ExtractedFile.new(z.get_entry(path)) end end |