From 27d83bc510984c94c61f203981f5bfd840d54d05 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Thu, 31 Mar 2016 17:35:52 -0400 Subject: update for crystal 0.14 --- src/guff/models/post.cr | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'src/guff/models/post.cr') 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 -- cgit v1.2.3