Skip to content

Commit

Permalink
Specs
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcsmith committed Mar 14, 2020
1 parent f685186 commit f9f853f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
32 changes: 31 additions & 1 deletion src/avram/charms/uuid_extensions.cr
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
syntax error in 'STDIN:19:21': unexpected token: )
struct UUID
def self.adapter
Lucky
end

module Lucky
alias ColumnType = String
include Avram::Type

def parse(value : UUID)
success(value)
end

def parse(values : Array(UUID))
success values
end

def parse(value : String)
success(value)
rescue
fail
end

def to_db(value : UUID)
value.to_s
end

class Criteria(T, V) < Avram::Criteria(T, V)
end
end
end
4 changes: 2 additions & 2 deletions src/avram/type.cr
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ module Avram::Type
to_db(parsed_value)
end

def success(value)
success(value)
def success(value : T) : SuccessfulCast(T) forall T
SuccessfulCast(T).new(value)
end

def fail
Expand Down

0 comments on commit f9f853f

Please sign in to comment.