Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.6
3.2.8
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source 'https://rubygems.org'
ruby '3.1.6'
ruby '3.2.8'

gem 'bootsnap'
gem 'pg'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ DEPENDENCIES
web-console

RUBY VERSION
ruby 3.1.6p260
ruby 3.2.8p263

BUNDLED WITH
2.5.19
6 changes: 3 additions & 3 deletions app/controllers/docs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def show
if @meta_image.end_with? '.webp'
# .webp -> .jpg
# .webp -> .png
@meta_image.gsub!('.webp', '.jpg') if File.exists? "public/#{@meta_image[0..-6]}.jpg"
@meta_image.gsub!('.webp', '.jpeg') if File.exists? "public/#{@meta_image[0..-6]}.jpeg"
@meta_image.gsub!('.webp', '.png') if File.exists? "public/#{@meta_image[0..-6]}.png"
@meta_image.gsub!('.webp', '.jpg') if File.exist? "public/#{@meta_image[0..-6]}.jpg"
@meta_image.gsub!('.webp', '.jpeg') if File.exist? "public/#{@meta_image[0..-6]}.jpeg"
@meta_image.gsub!('.webp', '.png') if File.exist? "public/#{@meta_image[0..-6]}.png"
end

# Add here if you want to optimize meta description.
Expand Down
2 changes: 1 addition & 1 deletion app/models/podcast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def path
def exists?(offset: 0)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【気になっている】 今回は標準ライブラリの File#exist? だけを変更していますが、このメソッドもそちらに合わせた方がよいか迷っています。

Document#exists? なども定義しているので、Podcast#exists? もそのままでよいかな?と判断したのですがフィードバックいただけると幸いです 🙏

Copy link
Member

@yasulab yasulab May 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kimihito PR ありがとうございます!😻🆒✨

ダックタイピングしているものなので他のも合わせて exist? に変えてもらえると助かります!(>人< )✨

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yasulab e8dcdf5 で対応してみました!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

早速のご対応ありがとうございます!マージしますね...!! 😻🆒✨

return false if self.path.include?("\u0000")
return false if (self.id + offset).zero?
File.exists?("#{DIR_PATH}/#{id + offset}.md")
File.exist?("#{DIR_PATH}/#{id + offset}.md")
end

def cover
Expand Down
8 changes: 4 additions & 4 deletions spec/models/podcast_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

context 'offset 省略' do
before :each do
allow(File).to receive(:exists?) { false }
allow(File).to receive(:exist?) { false }
end

it 'ファイルあり ⇒ true' do
allow(File).to receive(:exists?).with("public/podcasts/#{@podcast.id}.md") { true }
allow(File).to receive(:exist?).with("public/podcasts/#{@podcast.id}.md") { true }

expect(@podcast.exists?).to eq(true)
end
Expand All @@ -35,11 +35,11 @@

context 'offset 指定' do
before :each do
allow(File).to receive(:exists?) { false }
allow(File).to receive(:exist?) { false }
end

it 'ファイルあり ⇒ true' do
allow(File).to receive(:exists?).with("public/podcasts/#{@podcast.id + 1}.md") { true }
allow(File).to receive(:exist?).with("public/podcasts/#{@podcast.id + 1}.md") { true }

expect(@podcast.exists?(offset: 1)).to eq(true)
end
Expand Down