Sha256: 4543d446d149144dcbc95868e640a61b96c1d859d743dc9f5d3c9252d5f09b7c

Contents?: true

Size: 464 Bytes

Versions: 3

Compression:

Stored size: 464 Bytes

Contents

module SonJay
  module ActsAsModel

    def self.included(other)
      other.extend ClassBehavior
    end

    module ClassBehavior

      def parse_json(json)
        data = JSON.parse( json )
        instance = new
        instance.sonj_content.load_data data
        instance
      end

      def array_class
        @array_class ||= begin
          klass = SonJay::ModelArray( self )
          const_set :Array, klass
        end
      end

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
son_jay-0.4.1 lib/son_jay/acts_as_model.rb
son_jay-0.4.0 lib/son_jay/acts_as_model.rb
son_jay-0.3.0 lib/son_jay/acts_as_model.rb