Skip to content

Commit

Permalink
Fixed YARD docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dkubb committed Dec 12, 2009
1 parent de9f46a commit 3f64fd9
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 37 deletions.
16 changes: 8 additions & 8 deletions lib/extlib/class.rb
Expand Up @@ -28,8 +28,8 @@
class Class
# Defines class-level and instance-level attribute reader.
#
# @param *syms<Array> Array of attributes to define reader for.
# @return <Array[#to_s]> List of attributes that were made into cattr_readers
# @param [*syms<Array] Array of attributes to define reader for.
# @return [Array<#to_s>] List of attributes that were made into cattr_readers
#
# @api public
#
Expand All @@ -56,9 +56,9 @@ def #{sym}

# Defines class-level (and optionally instance-level) attribute writer.
#
# @param <Array[*#to_s, Hash{:instance_writer => Boolean}]> Array of attributes to define writer for.
# @param [Array<*#to_s, Hash{:instance_writer => Boolean}>] Array of attributes to define writer for.
# @option syms :instance_writer<Boolean> if true, instance-level attribute writer is defined.
# @return <Array[#to_s]> List of attributes that were made into cattr_writers
# @return [Array<#to_s>] List of attributes that were made into cattr_writers
#
# @api public
def cattr_writer(*syms)
Expand Down Expand Up @@ -88,7 +88,7 @@ def #{sym}=(obj)
#
# @param *syms<Array[*#to_s, Hash{:instance_writer => Boolean}]> Array of attributes to define accessor for.
# @option syms :instance_writer<Boolean> if true, instance-level attribute writer is defined.
# @return <Array[#to_s]> List of attributes that were made into accessors
# @return [Array<#to_s>] List of attributes that were made into accessors
#
# @api public
def cattr_accessor(*syms)
Expand All @@ -100,7 +100,7 @@ def cattr_accessor(*syms)
# each subclass has a copy of parent's attribute.
#
# @param *syms<Array[#to_s]> Array of attributes to define inheritable reader for.
# @return <Array[#to_s]> Array of attributes converted into inheritable_readers.
# @return [Array<#to_s>] Array of attributes converted into inheritable_readers.
#
# @api public
#
Expand Down Expand Up @@ -139,7 +139,7 @@ def #{ivar}
# @param *syms<Array[*#to_s, Hash{:instance_writer => Boolean}]> Array of attributes to
# define inheritable writer for.
# @option syms :instance_writer<Boolean> if true, instance-level inheritable attribute writer is defined.
# @return <Array[#to_s]> An Array of the attributes that were made into inheritable writers.
# @return [Array<#to_s>] An Array of the attributes that were made into inheritable writers.
#
# @api public
#
Expand Down Expand Up @@ -167,7 +167,7 @@ def #{ivar}=(obj) self.class.#{ivar} = obj end
# @param *syms<Array[*#to_s, Hash{:instance_writer => Boolean}]> Array of attributes to
# define inheritable accessor for.
# @option syms :instance_writer<Boolean> if true, instance-level inheritable attribute writer is defined.
# @return <Array[#to_s]> An Array of attributes turned into inheritable accessors.
# @return [Array<#to_s>] An Array of attributes turned into inheritable accessors.
#
# @api public
def class_inheritable_accessor(*syms)
Expand Down
14 changes: 7 additions & 7 deletions lib/extlib/hash.rb
Expand Up @@ -115,7 +115,7 @@ def to_params
# @param [Object] key The key for the param.
# @param [Object] value The value for the param.
#
# @return <String> This key value pair as a param
# @return [String] This key value pair as a param
#
# @api public
def normalize_param(key, value)
Expand Down Expand Up @@ -176,7 +176,7 @@ def except(*rejected)
hash
end

# @return <String> The hash as attributes for an XML tag.
# @return [String] The hash as attributes for an XML tag.
#
# @example
# { :one => 1, "two"=>"TWO" }.to_xml_attributes
Expand Down Expand Up @@ -209,7 +209,7 @@ def add_html_class!(html_class)
# Converts all keys into string values. This is used during reloading to
# prevent problems when classes are no longer declared.
#
# @return <Array> An array of they hash's keys
# @return [Array] An array of they hash's keys
#
# @example
# hash = { One => 1, Two => 2 }.proctect_keys!
Expand All @@ -234,7 +234,7 @@ def unprotect_keys!
# Destructively and non-recursively convert each key to an uppercase string,
# deleting nil values along the way.
#
# @return <Hash> The newly environmentized hash.
# @return [Hash] The newly environmentized hash.
#
# @example
# { :name => "Bob", :contact => { :email => "bob@bob.com" } }.environmentize_keys!
Expand Down Expand Up @@ -361,7 +361,7 @@ class << f
# "date"::
# Parses +value+ using Date.parse
#
# @return <Integer, TrueClass, FalseClass, Time, Date, Object>
# @return [Integer, Boolean, Time, Date, Object]
# The result of typecasting +value+.
#
# @note
Expand All @@ -377,7 +377,7 @@ def typecast_value(value)
#
# @param value<#gsub> An XML fragment.
#
# @return <#gsub> The XML fragment after converting entities.
# @return [#gsub] The XML fragment after converting entities.
def translate_xml_entities(value)
value.gsub(/&lt;/, "<").
gsub(/&gt;/, ">").
Expand All @@ -401,7 +401,7 @@ def inner_html

# Converts the node into a readable HTML node.
#
# @return <String> The HTML node in text form.
# @return [String] The HTML node in text form.
def to_html
attributes.merge!(:type => @type ) if @type
"<#{name}#{attributes.to_xml_attributes}>#{@nil_element ? '' : inner_html}</#{name}>"
Expand Down
22 changes: 11 additions & 11 deletions lib/extlib/mash.rb
Expand Up @@ -47,7 +47,7 @@ def []=(key, value)
# A hash to update values in the mash with. The keys and the values will be
# converted to Mash format.
#
# @return <Mash> The updated mash.
# @return [Mash] The updated mash.
def update(other_hash)
other_hash.each_pair { |key, value| regular_writer(convert_key(key), convert_value(value)) }
self
Expand All @@ -57,7 +57,7 @@ def update(other_hash)

# @param key<Object> The key to check for. This will be run through convert_key.
#
# @return <TrueClass, FalseClass> True if the key exists in the mash.
# @return [Boolean] True if the key exists in the mash.
def key?(key)
super(convert_key(key))
end
Expand All @@ -70,22 +70,22 @@ def key?(key)
# @param key<Object> The key to fetch. This will be run through convert_key.
# @param *extras<Array> Default value.
#
# @return <Object> The value at key or the default value.
# @return [Object] The value at key or the default value.
def fetch(key, *extras)
super(convert_key(key), *extras)
end

# @param *indices<Array>
# The keys to retrieve values for. These will be run through +convert_key+.
#
# @return <Array> The values at each of the provided keys
# @return [Array] The values at each of the provided keys
def values_at(*indices)
indices.collect {|key| self[convert_key(key)]}
end

# @param hash<Hash> The hash to merge with the mash.
#
# @return <Mash> A new mash with the hash values merged in.
# @return [Mash] A new mash with the hash values merged in.
def merge(hash)
self.dup.update(hash)
end
Expand All @@ -98,7 +98,7 @@ def delete(key)

# @param *rejected<Array[(String, Symbol)] The mash keys to exclude.
#
# @return <Mash> A new mash without the selected keys.
# @return [Mash] A new mash without the selected keys.
#
# @example
# { :one => 1, :two => 2, :three => 3 }.except(:one)
Expand All @@ -109,25 +109,25 @@ def except(*keys)

# Used to provide the same interface as Hash.
#
# @return <Mash> This mash unchanged.
# @return [Mash] This mash unchanged.
def stringify_keys!; self end

# @return <Hash> The mash as a Hash with symbolized keys.
# @return [Hash] The mash as a Hash with symbolized keys.
def symbolize_keys
h = Hash.new(default)
each { |key, val| h[key.to_sym] = val }
h
end

# @return <Hash> The mash as a Hash with string keys.
# @return [Hash] The mash as a Hash with string keys.
def to_hash
Hash.new(default).merge(self)
end

protected
# @param key<Object> The key to convert.
#
# @param <Object>
# @param [Object]
# The converted key. If the key was a symbol, it will be converted to a
# string.
#
Expand All @@ -138,7 +138,7 @@ def convert_key(key)

# @param value<Object> The value to convert.
#
# @return <Object>
# @return [Object]
# The converted value. A Hash or an Array of hashes, will be converted to
# their Mash equivalents.
#
Expand Down
18 changes: 9 additions & 9 deletions lib/extlib/object.rb
@@ -1,7 +1,7 @@
class Object
# Extracts the singleton class, so that metaprogramming can be done on it.
#
# @return <Class> The meta class.
# @return [Class] The meta class.
#
# @example [Setup]
# class MyString < String; end
Expand Down Expand Up @@ -60,7 +60,7 @@ def meta_class() class << self; self end end

# @param name<String> The name of the constant to get, e.g. "Merb::Router".
#
# @return <Object> The constant corresponding to the name.
# @return [Object] The constant corresponding to the name.
def full_const_get(name)
list = name.split("::")
list.shift if list.first.blank?
Expand All @@ -76,7 +76,7 @@ def full_const_get(name)
# @param name<String> The name of the constant to get, e.g. "Merb::Router".
# @param value<Object> The value to assign to the constant.
#
# @return <Object> The constant corresponding to the name.
# @return [Object] The constant corresponding to the name.
def full_const_set(name, value)
list = name.split("::")
toplevel = list.first.blank?
Expand All @@ -91,7 +91,7 @@ def full_const_set(name, value)
#
# @param name<String> The name of the full module name to make
#
# @return <NilClass>
# @return [nil]
def make_module(str)
mod = str.split("::")
current_module = self
Expand All @@ -114,7 +114,7 @@ def make_module(str)
# Check whether the object quacks_like? at least one of the options in the
# array.
#
# @return <TrueClass, FalseClass>
# @return [Boolean]
# True if the object quacks like duck.
def quacks_like?(duck)
case duck
Expand All @@ -131,7 +131,7 @@ def quacks_like?(duck)

# Override this in a child if it cannot be dup'ed
#
# @return <Object>
# @return [Object]
def try_dup
self.dup
end
Expand All @@ -140,7 +140,7 @@ def try_dup
# returns result. If not, just returns receiver
# itself
#
# @return <Object>
# @return [Object]
def try_call(*args)
if self.respond_to?(:call)
self.call(*args)
Expand All @@ -152,7 +152,7 @@ def try_call(*args)
# @param arrayish<#include?> Container to check, to see if it includes the object.
# @param *more<Array>:: additional args, will be flattened into arrayish
#
# @return <TrueClass, FalseClass>
# @return [Boolean]
# True if the object is included in arrayish (+ more)
#
# @example 1.in?([1,2,3]) #=> true
Expand All @@ -165,7 +165,7 @@ def in?(arrayish,*more)
# Add instance_variable_defined? for backward compatibility
# @param variable<Symbol, String>
#
# @return <TrueClass, FalseClass>
# @return [Boolean]
# True if the object has the given instance variable defined
unless respond_to?(:instance_variable_defined?)
def instance_variable_defined?(variable)
Expand Down
2 changes: 1 addition & 1 deletion lib/extlib/object_space.rb
Expand Up @@ -2,7 +2,7 @@ module ObjectSpace

class << self

# @return <Array[Class]> All the classes in the object space.
# @return [Array<Class>] All the classes in the object space.
def classes
klasses = []
ObjectSpace.each_object(Class) {|o| klasses << o}
Expand Down
2 changes: 1 addition & 1 deletion lib/extlib/rubygems.rb
Expand Up @@ -30,7 +30,7 @@ class Specification
# from any other location. If there are two gems of different versions in
# the gems directory, the later one will load as usual.
#
# @return <Array[Array]> The object used for sorting gem specs.
# @return [Array<Array>] The object used for sorting gem specs.
def sort_obj
[@name, installation_path == File.join(defined?(Merb) && Merb.respond_to?(:root) ? Merb.root : Dir.pwd,"gems") ? 1 : -1, @version.to_ints, @new_platform == Gem::Platform::RUBY ? -1 : 1]
end
Expand Down

0 comments on commit 3f64fd9

Please sign in to comment.