Skip to content

Commit

Permalink
documentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shime committed May 7, 2012
1 parent 384f339 commit a661501
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion lib/sinatra/config_file.rb
Expand Up @@ -10,7 +10,7 @@ module Sinatra
# the files contains specific environment settings and it will use the # the files contains specific environment settings and it will use the
# corresponding to the current one. # corresponding to the current one.
# #
# Within the application you can access those options through +settings+. If # You can access those options through +settings+ within the application. If
# you try to get the value for a setting that hasn't been defined in the # you try to get the value for a setting that hasn't been defined in the
# config file for the current environment, you will get whatever it was set # config file for the current environment, you will get whatever it was set
# to in the application. # to in the application.
Expand Down
4 changes: 2 additions & 2 deletions lib/sinatra/content_for.rb
Expand Up @@ -78,7 +78,7 @@ module ContentFor
def content_for(key, &block) def content_for(key, &block)
content_blocks[key.to_sym] << capture_later(&block) content_blocks[key.to_sym] << capture_later(&block)
end end

# Check if a block of content with the given key was defined. For # Check if a block of content with the given key was defined. For
# example: # example:
# #
Expand All @@ -100,7 +100,7 @@ def content_for?(key)
# <%= yield_content :head %> # <%= yield_content :head %>
# </head> # </head>
# #
# Would render everything you declared with <tt>content_for # Would render everything you declared with <tt>content_for
# :head</tt> before closing the <tt><head></tt> tag. # :head</tt> before closing the <tt><head></tt> tag.
# #
# You can also pass values to the content blocks by passing them # You can also pass values to the content blocks by passing them
Expand Down
2 changes: 1 addition & 1 deletion lib/sinatra/cookies.rb
Expand Up @@ -42,7 +42,7 @@ module Sinatra
# === Modular Application # === Modular Application
# #
# In a modular application you need to require the helpers, and then tell # In a modular application you need to require the helpers, and then tell
# the application you will use them: # the application to use them:
# #
# require "sinatra/base" # require "sinatra/base"
# require "sinatra/cookies" # require "sinatra/cookies"
Expand Down
2 changes: 1 addition & 1 deletion lib/sinatra/decompile.rb
Expand Up @@ -60,7 +60,7 @@ module Decompile
# end # end
# end # end
# #
# Will return the internal Regexp if unable to reconstruct the pattern, # Will return the internal Regexp if it's unable to reconstruct the pattern,
# which likely indicates that a Regexp was used in the first place. # which likely indicates that a Regexp was used in the first place.
# #
# You can also use this to check whether you could actually use a string # You can also use this to check whether you could actually use a string
Expand Down
10 changes: 5 additions & 5 deletions lib/sinatra/extension.rb
Expand Up @@ -6,12 +6,12 @@ module Sinatra
# = Sinatra::Extension # = Sinatra::Extension
# #
# <tt>Sinatra::Extension</tt> is a mixin that provides some syntactic sugar # <tt>Sinatra::Extension</tt> is a mixin that provides some syntactic sugar
# for your extensions. It allows you to call directly inside your extension # for your extensions. It allows you to call almost any
# module almost any <tt>Sinatra::Base</tt> method. This means you can use # <tt>Sinatra::Base</tt> method directly inside your extension
# +get+ to define a route, +before+ to define a before filter, +set+ to # module. This means you can use +get+ to define a route, +before+
# define a setting, a so on. # to define a before filter, +set+ to define a setting and so on.
# #
# Is important to be aware that this mixin remembers the methods calls you # Is important to be aware that this mixin remembers the method calls you
# make, and then, when your extension is registered, replays them on the # make, and then, when your extension is registered, replays them on the
# Sinatra application that has been extended. In order to do that, it # Sinatra application that has been extended. In order to do that, it
# defines a <tt>registered</tt> method, so, if your extension defines one # defines a <tt>registered</tt> method, so, if your extension defines one
Expand Down
4 changes: 2 additions & 2 deletions lib/sinatra/json.rb
Expand Up @@ -44,8 +44,8 @@ module Sinatra
# #
# === Encoders # === Encoders
# #
# Per default it will try to call +to_json+ on the object, but if it doesn't # By default it will try to call +to_json+ on the object, but if it doesn't
# respond to that message, will use its own, rather simple encoder. You can # respond to that message, it will use its own rather simple encoder. You can
# easily change that anyways. To use +JSON+, simply require it: # easily change that anyways. To use +JSON+, simply require it:
# #
# require 'json' # require 'json'
Expand Down
4 changes: 2 additions & 2 deletions lib/sinatra/link_header.rb
Expand Up @@ -53,8 +53,8 @@ module Sinatra
# #
module LinkHeader module LinkHeader
## ##
# Set Link HTTP header and returns HTML tags for telling the browser to # Sets Link HTTP header and returns HTML tags for telling the browser to
# prefetch given resources (only supported by Opera and Firefox at the # prefetch given resources (only supported by Opera and Firefox at the
# moment). # moment).
def prefetch(*urls) def prefetch(*urls)
link(:prefetch, *urls) link(:prefetch, *urls)
Expand Down
2 changes: 1 addition & 1 deletion lib/sinatra/namespace.rb
Expand Up @@ -14,7 +14,7 @@ module Sinatra
# #
# == Usage # == Usage
# #
# Once you have loaded the extension (see below), you use the +namespace+ # Once you have loaded the extension (see below), you can use the +namespace+
# method to define namespaces in your application. # method to define namespaces in your application.
# #
# You can define a namespace by a path prefix: # You can define a namespace by a path prefix:
Expand Down
10 changes: 5 additions & 5 deletions lib/sinatra/reloader.rb
Expand Up @@ -75,7 +75,7 @@ module Sinatra
module Reloader module Reloader


# Watches a file so it can tell when it has been updated, and what # Watches a file so it can tell when it has been updated, and what
# elements contains. # elements does it contain.
class Watcher class Watcher


# Represents an element of a Sinatra application that may need to # Represents an element of a Sinatra application that may need to
Expand All @@ -95,8 +95,8 @@ class Element < Struct.new(:type, :representation)
# Collection of file +Watcher+ that can be associated with a # Collection of file +Watcher+ that can be associated with a
# Sinatra application. That way, we can know which files belong # Sinatra application. That way, we can know which files belong
# to a given application and which files have been modified. It # to a given application and which files have been modified. It
# also provides a mechanism to inform a Watcher the elements # also provides a mechanism to inform a Watcher of the elements
# defined in the file being watched and if it changes should be # defined in the file being watched and if its changes should be
# ignored. # ignored.
class List class List
@app_list_map = Hash.new { |hash, key| hash[key] = new } @app_list_map = Hash.new { |hash, key| hash[key] = new }
Expand All @@ -113,7 +113,7 @@ def initialize
end end
end end


# Lets the +Watcher+ for the file localted at +path+ know that the # Lets the +Watcher+ for the file located at +path+ know that the
# +element+ is defined there, and adds the +Watcher+ to the +List+, # +element+ is defined there, and adds the +Watcher+ to the +List+,
# if it isn't already there. # if it isn't already there.
def watch(path, element) def watch(path, element)
Expand Down Expand Up @@ -159,7 +159,7 @@ def updated?
!ignore? && !removed? && mtime != File.mtime(path) !ignore? && !removed? && mtime != File.mtime(path)
end end


# Updates the file being watched mtime. # Updates the mtime of the file being watched.
def update def update
@mtime = File.mtime(path) @mtime = File.mtime(path)
end end
Expand Down
14 changes: 7 additions & 7 deletions lib/sinatra/respond_with.rb
@@ -1,11 +1,11 @@
require 'sinatra/base'
require 'sinatra/json' require 'sinatra/json'
require 'sinatra/base'


module Sinatra module Sinatra
## #
# = Sinatra::RespondWith # = Sinatra::RespondWith
# #
# This extensions lets Sinatra automatically choose what template to render or # These extensions let Sinatra automatically choose what template to render or
# action to perform depending on the request's Accept header. # action to perform depending on the request's Accept header.
# #
# Example: # Example:
Expand Down Expand Up @@ -53,8 +53,8 @@ module Sinatra
# == Security # == Security
# #
# Since methods are triggered based on client input, this can lead to security # Since methods are triggered based on client input, this can lead to security
# issues (but not as seviere as those might apear in the first place: keep in # issues (but not as severe as those might appear in the first place: keep in
# mind that only known file extensions are used). You therefore should limit # mind that only known file extensions are used). You should limit
# the possible formats you serve. # the possible formats you serve.
# #
# This is possible with the +provides+ condition: # This is possible with the +provides+ condition:
Expand All @@ -64,7 +64,7 @@ module Sinatra
# end # end
# #
# However, since you have to set +provides+ for every route, this extension # However, since you have to set +provides+ for every route, this extension
# adds a app global (class method) `respond_to`, that let's you define content # adds an app global (class method) `respond_to`, that lets you define content
# types for all routes: # types for all routes:
# #
# respond_to :html, :json, :xml, :atom # respond_to :html, :json, :xml, :atom
Expand Down Expand Up @@ -161,7 +161,7 @@ def respond_to(&block)
private private


def template_for(name, exts) def template_for(name, exts)
# in production this is cached, so don't worry to much about runtime # in production this is cached, so don't worry too much about runtime
possible = [] possible = []
settings.template_engines[:all].each do |engine| settings.template_engines[:all].each do |engine|
exts.each { |ext| possible << [engine, "#{name}.#{ext}"] } exts.each { |ext| possible << [engine, "#{name}.#{ext}"] }
Expand Down
10 changes: 5 additions & 5 deletions lib/sinatra/streaming.rb
Expand Up @@ -44,9 +44,9 @@ module Sinatra
# #
# == Better Middleware Handling # == Better Middleware Handling
# #
# Blocks passed to #map! or #map will actually be applied while streaming # Blocks passed to #map! or #map will actually be applied when streaming
# (as you might suspect, #map! applies modifications to the current body, # takes place (as you might have suspected, #map! applies modifications
# #map creates a new one): # to the current body, while #map creates a new one):
# #
# class StupidMiddleware # class StupidMiddleware
# def initialize(app) @app = app end # def initialize(app) @app = app end
Expand Down Expand Up @@ -89,7 +89,7 @@ module Sinatra
# #
# require "sinatra/base" # require "sinatra/base"
# require "sinatra/streaming" # require "sinatra/streaming"
# #
# class MyApp < Sinatra::Base # class MyApp < Sinatra::Base
# helpers Sinatra::Streaming # helpers Sinatra::Streaming
# end # end
Expand Down Expand Up @@ -264,4 +264,4 @@ def tty?
end end


helpers Streaming helpers Streaming
end end

0 comments on commit a661501

Please sign in to comment.