Sha256: 41687167eb424ddb764328a9f56e5ecc164ba8c9af0a617fa8aaf611ced618aa

Contents?: true

Size: 596 Bytes

Versions: 1

Compression:

Stored size: 596 Bytes

Contents

require 'active_support/concern'
require 'virtus'
require 'active_model'

module GeojsonModel
  module Base
    extend ActiveSupport::Concern

    included do
      include Virtus.model
      include ActiveModel::Serializers::JSON

      alias_method :to_geojson, :to_json
    end

    # include ActiveModel::Model
    # include ActiveModel::Dirty
    # include ActiveModel::Validations

    # validates :geojson, geojson: true

    def attributes=(hash)
      hash.each do |key, value|
        send("#{key}=", value)
      end
    end

    def attributes
      instance_values
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geojson_model-0.1.1 lib/geojson_model/base.rb