Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add documentation to between and time_klass methods

  • Loading branch information...
commit f4d08d75b82af8e1586a07622c6b04e99569c526 1 parent 61a06c0
@radar authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/by_star.rb
View
6 lib/by_star.rb
@@ -17,6 +17,9 @@ class ParseError < StandardError
end
+ # Returns all records between a given start and finish time.
+ #
+ # Currently only supports Time objects.
def between(start, finish, options={})
field = options[:field] || by_star_field
scope = where("#{field} >= ? AND #{field} <= ?",
@@ -27,6 +30,9 @@ def between(start, finish, options={})
private
+ # Used inside the by_* methods to determine what kind of object "time" is.
+ # These methods take the result of the time_klass method, and call other methods
+ # using it, such as by_year_Time and by_year_String.
def time_klass(time)
case time
when ActiveSupport::TimeWithZone
Please sign in to comment.
Something went wrong with that request. Please try again.