Module: OCms::ExistsHelper
- Defined in:
- app/helpers/o_cms/exists_helper.rb
Instance Method Summary collapse
Instance Method Details
#javascript_exists?(script) ⇒ Boolean
11 12 13 14 15 16 17 |
# File 'app/helpers/o_cms/exists_helper.rb', line 11 def javascript_exists?(script) script = "#{Rails.root}/app/assets/javascripts/#{script}.js" extensions = %w(.coffee .erb .coffee.erb) + [""] extensions.inject(false) do |truth, extension| truth || File.exists?("#{script}#{extension}") end end |
#stylesheet_exists?(stylesheet) ⇒ Boolean
3 4 5 6 7 8 9 |
# File 'app/helpers/o_cms/exists_helper.rb', line 3 def stylesheet_exists?(stylesheet) stylesheet = "#{Rails.root}/app/assets/stylesheets/#{stylesheet}.scss" extensions = %w(.scss .erb .scss.erb) + [""] extensions.inject(false) do |truth, extension| truth || File.exists?("#{stylesheet}#{extension}") end end |