Skip to content

Commit

Permalink
fixing up docs; booboo in pl.types
Browse files Browse the repository at this point in the history
  • Loading branch information
stevedonovan committed Sep 13, 2013
1 parent ec71ea1 commit a62d30d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion doc/manual/05-dates.md
Expand Up @@ -2,7 +2,7 @@

<a id="date"></a>

### Manipulating Dates
### Creating and Displaying Dates

The `Date` class provides a simplified way to work with [date and
time](http://www.lua.org/pil/22.1.html) in Lua; it leans heavily on the functions
Expand Down
18 changes: 9 additions & 9 deletions lua/pl/Date.lua
Expand Up @@ -21,7 +21,7 @@ Date.Format = class()
-- * number - seconds since epoch (as returned by `os.time`). Resulting time is UTC
-- * `Date` - make a copy of this date
-- * table - table containing year, month, etc as for `os.time`. You may leave out year, month or day,
-- in which case current values will be used.
-- in which case current values will be used.
-- * year (will be followed by month, day etc)
--
-- @param ... true if Universal Coordinated Time, or two to five numbers: month,day,hour,min,sec
Expand Down Expand Up @@ -263,7 +263,7 @@ end
--- long numerical ISO data format version of this date.
function Date:__tostring()
local t = os_date('%Y-%m-%dT%H:%M:%S',self.time)
if self.utc then
if self.utc then
return t .. 'Z'
else
local offs = self:tzone()
Expand Down Expand Up @@ -292,6 +292,7 @@ function Date:__lt(other)
end

--- difference between Date objects.
-- @function Date:__sub
Date.__sub = Date.diff

--- add a date and an interval.
Expand Down Expand Up @@ -368,12 +369,11 @@ local formats = {
-- Alternatively, if fmt is nil then this returns a flexible date parser
-- that tries various date/time schemes in turn:
--
-- # [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601),
-- like `2010-05-10 12:35:23Z` or `2008-10-03T14:30+02`
-- # times like 15:30 or 8.05pm (assumed to be today's date)
-- # dates like 28/10/02 (European order!) or 5 Feb 2012
-- # month name like march or Mar (case-insensitive, first 3 letters);
-- here the day will be 1 and the year this current year
-- * [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601), like `2010-05-10 12:35:23Z` or `2008-10-03T14:30+02`
-- * times like 15:30 or 8.05pm (assumed to be today's date)
-- * dates like 28/10/02 (European order!) or 5 Feb 2012
-- * month name like march or Mar (case-insensitive, first 3 letters); here the
-- day will be 1 and the year this current year
--
-- A date in format 3 can be optionally followed by a time in format 2.
-- Please see test-date.lua in the tests folder for more examples.
Expand Down Expand Up @@ -621,7 +621,7 @@ local function parse_date_unsafe (s,US)
res.utc = true
-- we're in UTC, so let's go local...
res = res:toLocal()
end
end
return res
end

Expand Down
18 changes: 10 additions & 8 deletions lua/pl/types.lua
Expand Up @@ -76,15 +76,15 @@ end

--- can an object be iterated over with `ipairs`?
-- @param val any value.
function types.is_iterable (idx,val)
function types.is_iterable (val)
local mt = check_meta(val)
if mt == true then return true end
return not(mt and mt.__pairs)
end

--- can an object accept new key/pair values?
-- @param val any value.
function types.is_writeable (idx,val)
function types.is_writeable (val)
local mt = check_meta(val)
if mt == true then return true end
return not(mt and mt.__newindex)
Expand Down Expand Up @@ -112,15 +112,17 @@ local true_types = {
}
--- Convert to a boolean value.
-- True values are:
-- * boolean: true (doesn't make sense to pass a boolean to a to boolean function though...).
-- * string: yes, y, true, t, 1 or additional strings specified by true_strs.
--
-- * boolean: true.
-- * string: 'yes', 'y', 'true', 't', '1' or additional strings specified by `true_strs`.
-- * number: Any non-zero value.
-- * table: Is not empty and check_objs is true.
-- * object: Is not nil and check_objs is true.
-- * table: Is not empty and `check_objs` is true.
-- * object: Is not `nil` and `check_objs` is true.
--
-- @param o The object to evaluate.
-- @param true_strs optional Additional strings that when matched should evaluate to true. Comparison is case insensitive.
-- @param[opt] true_strs optional Additional strings that when matched should evaluate to true. Comparison is case insensitive.
-- This should be a List of strings. E.g. "ja" to support German.
-- @param optional check_objs True if objects should be evaluated. Default is to evaluate objects as true if not nil
-- @param[opt] check_objs True if objects should be evaluated. Default is to evaluate objects as true if not nil
-- or if it is a table and it is not empty.
-- @return true if the input evaluates to true, otherwise false.
function types.to_bool(o, true_strs, check_objs)
Expand Down
1 change: 0 additions & 1 deletion lua/pl/utils.lua
Expand Up @@ -319,7 +319,6 @@ local ops
-- @param msg optional error message
-- @return a callable
-- @raise if idx is not a number or if f is not callable
-- @see utils.is_callable
function utils.function_arg (idx,f,msg)
utils.assert_arg(1,idx,'number')
local tp = type(f)
Expand Down

0 comments on commit a62d30d

Please sign in to comment.