Sha256: 75d4e6d3074a1a7b971c8c4bd9cd768165642a4244721237225a13a3025c9ce3

Contents?: true

Size: 497 Bytes

Versions: 1

Compression:

Stored size: 497 Bytes

Contents

class Structure
  module Ext
    module ActiveSupport
      def as_json(options = nil)
        subset = if options
          if only = options[:only]
            marshal_dump.slice(*Array.wrap(only))
          elsif except = options[:except]
            marshal_dump.except(*Array.wrap(except))
          else
            marshal_dump
          end
        else
          marshal_dump
        end

        { JSON.create_id => self.class.name }.
          merge(subset)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
structure-0.23.0 lib/structure/ext/active_support.rb