TextText-based

text/x-ruby

Ruby Source

Reference for text/x-ruby, the MIME type for Ruby programming language source code files.

MIME Type Detector

Drop a file to detect its MIME type — no upload, runs in your browser

📄

Drop any file here or click to choose

Expected extensions: .rb, .rake

HTTP Content-Type Header

HTTP Header
Content-Type: text/x-ruby; charset=utf-8

Associated File Extensions

.rb.rake

Quick Facts

MIME Typetext/x-ruby
CategoryText
TypeText-based (human-readable)
Extensions.rb, .rake

Common Usage

Ruby source files power web applications (Ruby on Rails), automation (Chef, Vagrant), scripting, and DevOps tooling. Ruby on Rails popularized the MVC web framework pattern and conventions like REST and convention over configuration.

Code Examples

HTML
<!-- Link or embed with explicit type -->
<link rel="stylesheet" href="file.rb" type="text/x-ruby">

<!-- Or for script/media elements -->
<script type="text/x-ruby" src="file.rb"></script>
Node.js
// Express.js
app.get('/file', (req, res) => {
  res.type('text/x-ruby');
  res.send(data);
});

// Node.js http
res.writeHead(200, { 'Content-Type': 'text/x-ruby' });
nginx
# nginx.conf — add to types block or use default
types {
    text/x-ruby  rb rake;
}

# Or set for a specific location
location /api/ {
    default_type text/x-ruby;
}

Related MIME Types

More Text MIME Types

Other text types in the Text family

Related Tools

Explore More MIME Types

Browse our complete reference of 185 MIME types with usage examples, HTTP headers, and code snippets.