Skip to content

Commit

Permalink
Merge pull request #1772 from sul-dlss/remove-methods
Browse files Browse the repository at this point in the history
Remove unused methods that were previously identified for removal
  • Loading branch information
aaron-collier authored Nov 17, 2023
2 parents 6424640 + 798e5bb commit 5c77288
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
16 changes: 0 additions & 16 deletions app/models/embed/purl/resource_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def previewable?
preview_types.include?(mimetype)
end

# unused (9/2016) - candidate for removal?
def image?
mimetype =~ %r{image/jp2}i
end
Expand All @@ -74,26 +73,11 @@ def size
@file.attributes['size']&.value.to_i
end

# unused (9/2016) - candidate for removal?
def height
@file.xpath('./*/@height').first.try(:text) if @file.xpath('./*/@height').present?
end

# unused (9/2016) - candidate for removal?
def width
@file.xpath('./*/@width').first.try(:text) if @file.xpath('./*/@width').present?
end

def duration
md = Embed::MediaDuration.new(@file.xpath('./*[@duration]').first) if @file.xpath('./*/@duration').present?
md&.to_s
end

# unused (9/2016) - candidate for removal?
def location
@file.xpath('./location[@type="url"]').first.try(:text) if @file.xpath('./location[@type="url"]').present?
end

def stanford_only?
value, _rule = @rights.stanford_only_rights_for_file(title)

Expand Down
34 changes: 0 additions & 34 deletions spec/models/embed/purl/resource_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,27 +199,6 @@
end
end

describe 'image data' do
before { stub_purl_xml_response_with_fixture(image_purl_xml) }

let(:image) { Embed::Purl.new('12345').contents.first.files.first }

it 'gets the image height and width for image objects' do
expect(image.height).to eq '6123'
expect(image.width).to eq '5321'
end
end

describe 'file data' do
before { stub_purl_xml_response_with_fixture(file_purl_xml) }

let(:file) { Embed::Purl.new('12345').contents.first.files.first }

it 'gets the location data when available' do
expect(file.location).to eq 'http://stacks.stanford.edu/file/druid:abc123/Title_of_the_PDF.pdf'
end
end

describe 'duration' do
it 'gets duration string from videoData' do
f = double('File')
Expand Down Expand Up @@ -261,19 +240,6 @@
end
end

describe 'video_data' do
context 'with valid videoData' do
before { stub_purl_xml_response_with_fixture(multi_media_purl) }

let(:video) { Embed::Purl.new('12345').contents.first.files.first }

it 'gets the height and width for the video object' do
expect(video.height).to eq '288'
expect(video.width).to eq '352'
end
end
end

describe '#vtt?' do
subject { file.vtt? }

Expand Down

0 comments on commit 5c77288

Please sign in to comment.