Sha256: c698e9849a7e4aaf4cb7a20420a8086b71619a92059c7c44a3e25c991aa3f957
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
require 'crowi/client/model/crowi_model' # Crowi Page revision model class class CrowiPageRevision < CrowiModelBase attr_reader :_id, :author, :body, :path, :__v, :createdAt, :format # Constractor # @param [Hash] User model shown as hash # @todo Except running register method always called parse method. def initialize(params = {}) init_params = { _id: '', author: nil, body: nil, path: nil, __v: 0, createdAt: nil, format: '' } params = init_params.merge(params.map { |k,v| [k.to_sym, v] }.to_h) if (params[:_id] == nil || params[:path] == nil) raise ArgumentError.new('Parameters _id and path are required.') end CrowiModelFactory.instance.register({ page_revision_createdAt: Proc.new { |date_str| date_str != nil && DateTime.parse(date_str) }, }) maked_params = {} params.each do |k,v| maker = CrowiModelFactory.instance.maker('page_revision_' + k.to_s) maked_params[k] = maker.call(v) end super(maked_params) end end
Version data entries
5 entries across 5 versions & 1 rubygems