Skip to content

Commit

Permalink
define JSON.lower(CatValue) if JSON is available
Browse files Browse the repository at this point in the history
fixes #95
  • Loading branch information
alyst committed Jan 8, 2018
1 parent aa30eea commit 91e9676
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
Expand Up @@ -2,3 +2,4 @@ julia 0.6
Missings
Reexport
Compat 0.39.0
Requires
1 change: 1 addition & 0 deletions src/CategoricalArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module CategoricalArrays
if VERSION >= v"0.7.0-DEV.3052"
using Printf
end
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 @@ -160,3 +160,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 91e9676

Please sign in to comment.