Skip to content

Commit

Permalink
Do a better job of linking class/method RDocs to the guides
Browse files Browse the repository at this point in the history
This links all of the guides except the reflection guide to at least
one class or method.  There's probably more places that should link
to the guides, but this is a good start.
  • Loading branch information
jeremyevans committed Apr 19, 2010
1 parent 05fdc1c commit 4bcf034
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
6 changes: 5 additions & 1 deletion lib/sequel/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
#
# You can set the SEQUEL_NO_CORE_EXTENSIONS constant or environment variable to have
# Sequel not extend the core classes.
#
# For a more expanded introduction, see the {README}[link:files/README_rdoc.html].
# For a quicker introduction, see the {cheat sheet}[link:files/doc/cheat_sheet_rdoc.html].
module Sequel
@convert_two_digit_years = true
@datetime_class = Time
Expand Down Expand Up @@ -118,7 +121,8 @@ def self.condition_specifier?(obj)
#
# Sequel.connect('sqlite://blog.db'){|db| puts db[:users].count}
#
# For details, see the "Connecting to a Database" Guide.
# For details, see the {"Connecting to a Database" guide}[link:files/doc/opening_databases_rdoc.html].
# To set up a master/slave or sharded database connection, see the {"Master/Slave Databases and Sharding" guide}[link:files/doc/sharding_rdoc.html].
def self.connect(*args, &block)
Database.connect(*args, &block)
end
Expand Down
6 changes: 6 additions & 0 deletions lib/sequel/database/schema_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ module Schema
# Schema::Generator has some methods but also includes method_missing,
# allowing users to specify column type as a method instead of using
# the column method, which makes for a nicer DSL.
#
# For more information on Sequel's support for schema modification, see
# the {"Schema Modification" guide}[link:files/doc/schema_rdoc.html].
class Generator
# Classes specifying generic types that Sequel will convert to database-specific types.
GENERIC_TYPES=[String, Integer, Fixnum, Bignum, Float, Numeric, BigDecimal,
Expand Down Expand Up @@ -200,6 +203,9 @@ def composite_foreign_key(columns, opts)
# object and a block of operations to perform on the table, and
# gives the Database a table an array of operations, which the database uses to
# alter a table's description.
#
# For more information on Sequel's support for schema modification, see
# the {"Schema Modification" guide}[link:files/doc/schema_rdoc.html].
class AlterTableGenerator
# An array of DDL operations to perform
attr_reader :operations
Expand Down
4 changes: 2 additions & 2 deletions lib/sequel/database/schema_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def add_index(table, columns, options={})
# definitions using create_table, and #add_index accepts all the options
# available for index definition.
#
# See Schema::AlterTableGenerator.
# See Schema::AlterTableGenerator and the {"Schema Modification" guide}[link:files/doc/schema_rdoc.html].
def alter_table(name, generator=nil, &block)
remove_cached_schema(name)
generator ||= Schema::AlterTableGenerator.new(self, &block)
Expand All @@ -66,7 +66,7 @@ def alter_table(name, generator=nil, &block)
# * :temp - Create the table as a temporary table.
# * :ignore_index_errors - Ignore any errors when creating indexes.
#
# See Schema::Generator.
# See Schema::Generator and the {"Schema Modification" guide}[link:files/doc/schema_rdoc.html].
def create_table(name, options={}, &block)
options = {:generator=>options} if options.is_a?(Schema::Generator)
generator = options[:generator] || Schema::Generator.new(self, &block)
Expand Down
2 changes: 2 additions & 0 deletions lib/sequel/dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module Sequel
#
# Datasets are Enumerable objects, so they can be manipulated using any
# of the Enumerable methods, such as map, inject, etc.
#
# For more information, see the {"Dataset Basics" guide}[link:files/doc/dataset_basics_rdoc.html].
class Dataset
extend Metaprogramming
include Metaprogramming
Expand Down
2 changes: 1 addition & 1 deletion lib/sequel/dataset/prepared_statements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Dataset
# ---------------------
# :section: Methods related to prepared statements or bound variables
# On some adapters, these use native prepared statements and bound variables, on others
# support is emulated.
# support is emulated. For details, see the {"Prepared Statements/Bound Variables" guide}[link:files/doc/prepared_statements_rdoc.html].
# ---------------------

PREPARED_ARG_PLACEHOLDER = LiteralString.new('?').freeze
Expand Down
5 changes: 3 additions & 2 deletions lib/sequel/dataset/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def exclude(*cond, &block)
#
# filter also takes a block, which should return one of the above argument
# types, and is treated the same way. This block yields a virtual row object,
# which is easy to use to create identifiers and functions.
# which is easy to use to create identifiers and functions. For more details
# on the virtual row support, see the {"Virtual Rows" guide}[link:files/doc/virtual_rows_rdoc.html]
#
# If both a block and regular argument
# are provided, they get ANDed together.
Expand All @@ -133,7 +134,7 @@ def exclude(*cond, &block)
# software.filter{|o| o.price < 100}.sql #=>
# "SELECT * FROM items WHERE ((category = 'software') AND (price < 100))"
#
# See doc/dataset_filtering.rdoc for more examples and details.
# See the the {"Dataset Filtering" guide}[link:files/doc/dataset_filtering_rdoc.html] for more examples and details.
def filter(*cond, &block)
_filter(@opts[:having] ? :having : :where, *cond, &block)
end
Expand Down
24 changes: 13 additions & 11 deletions lib/sequel/model/associations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -410,17 +410,17 @@ module AssociationDatasetMethods
# end
#
# The project class now has the following instance methods:
# * portfolio - Returns the associated portfolio.
# * portfolio=(obj) - Sets the associated portfolio to the object,
# but the change is not persisted until you save the record (for many_to_one associations).
# * portfolio_dataset - Returns a dataset that would return the associated
# portfolio, only useful in fairly specific circumstances.
# * milestones - Returns an array of associated milestones
# * add_milestone(obj) - Associates the passed milestone with this object.
# * remove_milestone(obj) - Removes the association with the passed milestone.
# * remove_all_milestones - Removes associations with all associated milestones.
# * milestones_dataset - Returns a dataset that would return the associated
# milestones, allowing for further filtering/limiting/etc.
# portfolio :: Returns the associated portfolio.
# portfolio=(obj) :: Sets the associated portfolio to the object,
# but the change is not persisted until you save the record (for many_to_one associations).
# portfolio_dataset :: Returns a dataset that would return the associated
# portfolio, only useful in fairly specific circumstances.
# milestones :: Returns an array of associated milestones
# add_milestone(obj) :: Associates the passed milestone with this object.
# remove_milestone(obj) :: Removes the association with the passed milestone.
# remove_all_milestones :: Removes associations with all associated milestones.
# milestones_dataset :: Returns a dataset that would return the associated
# milestones, allowing for further filtering/limiting/etc.
#
# If you want to override the behavior of the add_/remove_/remove_all_/ methods
# or the association setter method, there are private instance methods created that are prepended
Expand All @@ -439,6 +439,8 @@ module AssociationDatasetMethods
# => [:portfolio, :milestones]
# Project.association_reflection(:portfolio)
# => {:type => :many_to_one, :name => :portfolio, :class_name => "Portfolio"}
#
# For examples of advanced usage, see the {Advanced Associations page}[link:files/doc/advanced_associations_rdoc.html].
module ClassMethods
# All association reflections defined for this model (default: none).
attr_reader :association_reflections
Expand Down

0 comments on commit 4bcf034

Please sign in to comment.