Skip to content

Commit

Permalink
define JSON.lower(CatValue) if JSON is available
Browse files Browse the repository at this point in the history
  • Loading branch information
alyst committed Oct 30, 2017
1 parent fe4fd47 commit 0ed73a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
julia 0.6
Nulls 0.1.2
Reexport
Requires
1 change: 1 addition & 0 deletions src/CategoricalArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module CategoricalArrays
using Compat
using Reexport
@reexport using Nulls
using Requires

include("typedefs.jl")

Expand Down
7 changes: 7 additions & 0 deletions src/value.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,10 @@ Base.match(r::Regex, s::CategoricalString,
Base.matchall(r::Regex, s::CategoricalString, overlap::Bool=false) =
matchall(r, get(s), overlap)
Base.collect(x::CategoricalString) = collect(get(x))

@require JSON begin

# Serialize CatValue as the value it refers to (fixes #95)
JSON.lower(x::CatValue) = get(x)

end

0 comments on commit 0ed73a1

Please sign in to comment.