Skip to content
Browse files

Merge branch 'patch-1' of https://github.com/mnicky/clj-record

  • Loading branch information...
2 parents 1c1795d + 2f5da0c commit 7575850672e09d0b00a426014884ec21c2a91f8e @duelinmarkers committed Aug 23, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −1 README.textile
  2. +3 −3 src/clj_record/util.clj
View
2 README.textile
@@ -54,7 +54,7 @@ into function definitions for basic crud operations:
* destroy-record (from a map of attributes that must include :id)
* record-count (by optional map of attributes)
-See the functions of the same names in "clj-record.core":http://github.com/duelinmarkers/clj-record/tree/master/clj_record/core.clj for documentation.
+See the functions of the same names in "clj-record.core":https://github.com/duelinmarkers/clj-record/blob/master/src/clj_record/core.clj for documentation.
(The functions in clj-record.core take the model-name as a first argument. The functions generated in your model namespace already know what model they're about, so they don't take that argument. Otherwise the functions are the same.)
Additional optional arguments to init-model can generate richer functionality.
View
6 src/clj_record/util.clj
@@ -2,22 +2,22 @@
"Assorted utilities for internal use."
(:require [clojure.string :as string]))
-(defn singularize [plural]
+(defn singularize [^String plural]
(let [lc (.toLowerCase plural)]
(condp re-find lc
#"ies$" (string/replace lc #"ies$" "y")
#"(s|z|ch|sh|x)es$" (string/replace lc #"(s|z|ch|sh|x)es$" "$1")
#"s$" (string/replace lc #"s$" "")
lc)))
-(defn pluralize [word]
+(defn pluralize [^String word]
(let [lc (.toLowerCase word)]
(cond
(.endsWith lc "y") (string/replace lc #"y$" "ies")
(some #(.endsWith lc %) ["s" "z" "ch" "sh" "x"]) (str lc "es")
:else (str lc "s"))))
-(defn dashes-to-underscores [s]
+(defn dashes-to-underscores [^String s]
(.replaceAll s "-" "_"))
(defmulti id-query-for :subprotocol)

0 comments on commit 7575850

Please sign in to comment.
Something went wrong with that request. Please try again.