module RobotsDotText::Controller

Public Instance Methods

show() click to toggle source
# File lib/robots_dot_text/controller.rb, line 5
def show
  begin
    render file: robots_file_path, layout: false, content_type: 'text/plain'
  rescue ActionView::MissingTemplate
    render file: default_robots_path, layout: false, content_type: 'text/plain'
  end
end

Private Instance Methods

default_robots_path() click to toggle source
# File lib/robots_dot_text/controller.rb, line 19
def default_robots_path
  File.join([Rails.root, 'public', 'robots.default.txt'])
end
robots_file_descriptor() click to toggle source
# File lib/robots_dot_text/controller.rb, line 23
def robots_file_descriptor
  Rails.env.to_s
end
robots_file_path() click to toggle source
# File lib/robots_dot_text/controller.rb, line 15
def robots_file_path
  File.join([Rails.root, 'public', "robots.#{robots_file_descriptor}.txt"])
end