diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-03-31 17:35:52 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-03-31 17:35:52 -0400 |
commit | 27d83bc510984c94c61f203981f5bfd840d54d05 (patch) | |
tree | f6761cb71a5a6a0a94da81ce8031e662b6ac7d6f /src/guff/models | |
parent | d0d3a18a63948740027fb9fd760e9a7b15032776 (diff) | |
download | old-guff-27d83bc510984c94c61f203981f5bfd840d54d05.tar.bz2 old-guff-27d83bc510984c94c61f203981f5bfd840d54d05.zip |
update for crystal 0.14
Diffstat (limited to 'src/guff/models')
-rw-r--r-- | src/guff/models/post.cr | 52 | ||||
-rw-r--r-- | src/guff/models/tag.cr | 10 |
2 files changed, 31 insertions, 31 deletions
diff --git a/src/guff/models/post.cr b/src/guff/models/post.cr index 826bb7c..fa34c2d 100644 --- a/src/guff/models/post.cr +++ b/src/guff/models/post.cr @@ -156,13 +156,13 @@ module Guff ##################### def get_posts( - cols = nil : Array(String)?, - site_id = nil : Int?, - filters = {} of Symbol => String : Hash(Symbol, String), - tags = [] of Array(String) : Array(Array(String)), - page = 1 : Int, - limit = 20 : Int, - sort = nil : Array(Hash(String, String))?, + cols : Array(String)? = nil, + site_id : Int? = nil, + filters : Hash(Symbol, String) = {} of Symbol => String, + tags : Array(Array(String)) = [] of Array(String), + page : Int = 1, + limit : Int = 20, + sort : Array(Hash(String, String))? = nil, ) # build sql args sql_args = { @@ -298,7 +298,7 @@ module Guff }] private def get_sort_clause( - sort = nil : Array(Hash(String, String))? + sort : Array(Hash(String, String))? = nil ) : String (sort || GET_POSTS_DEFAULT_SORT).map { |row| # verify sort column @@ -350,12 +350,12 @@ module Guff #################### def add_post( - site_id = nil : Int?, - slug = "" : String, - name = "" : String, - body = "" : String, - tags = [] of String : Array(String), - state = "draft" : String?, + site_id : Int? = nil, + slug : String = "", + name : String = "", + body : String = "", + tags : Array(String) = [] of String, + state : String? = "draft", ) : Int64 post_id = -1_i64 @@ -394,13 +394,13 @@ module Guff ####################### def update_post( - site_id = nil : Int?, - post_id = nil : Int?, - slug = nil : String?, - name = nil : String?, - body = nil : String?, - tags = nil : Array(String)?, - state = nil : String? + site_id : Int? = nil, + post_id : Int? = nil, + slug : String? = nil, + name : String? = nil, + body : String? = nil, + tags : Array(String)? = nil, + state : String? = nil ) raise "null post_id" if post_id.nil? @@ -470,8 +470,8 @@ module Guff ################ def remove_posts( - site_id = nil : Int?, - post_ids = [] of Int : Array(Int) + site_id : Int? = nil, + post_ids : Array(Int) = [] of Int, ) query(:remove_posts, { "site_id": (site_id || @models.site.get_default).to_s, @@ -490,9 +490,9 @@ module Guff #################### def set_tags( - site_id = nil : Int?, - post_id = nil : Int?, - tags = [] of String : Array(String), + site_id : Int? = nil, + post_id : Int? = nil, + tags : Array(String) = [] of String, ) return unless post_id diff --git a/src/guff/models/tag.cr b/src/guff/models/tag.cr index 46a69eb..f4232ce 100644 --- a/src/guff/models/tag.cr +++ b/src/guff/models/tag.cr @@ -47,8 +47,8 @@ module Guff end def get_tags( - tags = [] of String : Array(String), - show_all = false : Bool, + tags : Array(String) = [] of String, + show_all : Bool = false, ) : Array(Hash(String, String | Int32)) r = [] of Hash(String, String | Int32) @@ -81,7 +81,7 @@ module Guff end def add_tags( - tags = [] of String : Array(String) + tags : Array(String) = [] of String, ) missing_tags = get_missing_tags(tags) @@ -95,7 +95,7 @@ module Guff end private def get_missing_tags( - tags = [] of String : Array(String) + tags : Array(String) = [] of String, ) : Array(String) # get ids of existing tags ids = get_ids(tags) @@ -105,7 +105,7 @@ module Guff end private def get_ids( - tags = [] of String : Array(String) + tags : Array(String) = [] of String, ) : Hash(String, Int32) r = {} of String => Int32 |