Sha256: 5ce8212add68319f803f25266b6a8c8ae67e98618e4c4442421079714c0f8215
Contents?: true
Size: 781 Bytes
Versions: 5
Compression:
Stored size: 781 Bytes
Contents
require 'rest_in_peace/definition_proxy' module RESTinPeace def self.included(base) base.send :extend, ClassMethods end def api self.class.api end def initialize(attributes = {}) update_from_hash(attributes) end def to_h Hash[each_pair.to_a] end protected def update_from_hash(hash) hash.each do |key, value| next unless self.class.members.map(&:to_s).include?(key.to_s) send("#{key}=", value) end end module ClassMethods attr_accessor :api def rest_in_peace(&block) definition_proxy = RESTinPeace::DefinitionProxy.new(self) definition_proxy.instance_eval(&block) end def rip_registry @rip_registry ||= { resource: [], collection: [], } end end end
Version data entries
5 entries across 5 versions & 1 rubygems