Sha256: 5e5d01b1e85ca2f7de3487952e3f29be7eff089e5f1a2d84c162ae0cdb2da917
Contents?: true
Size: 1 KB
Versions: 6
Compression:
Stored size: 1 KB
Contents
unless String.respond_to? "plural" class String def plural self + "s" end end end module Ixtlan module SerializableModel def self.included(model) model.send :include, ActiveModel::Serializers::JSON model.send :include, ActiveModel::Serializers::Xml end def attributes=(attributes) attributes.each do |k, v| if k == k.plural v = case v when String [v] when Array v when Hash v.values.flatten end end send("#{k}=", v) end end def attributes map = instance_variables.collect do |name| [name[1,1000], send(name[1,1000].to_sym)] end.reject do |x| x[1] == nil end Hash[map] end end end module Ixtlan module Guard module Models class Maintenance include Ixtlan::SerializableModel attr_accessor :groups end end end end
Version data entries
6 entries across 6 versions & 1 rubygems