module SocialStream::Models::Supertype::ClassMethods
Public Instance Methods
normalize(a)
click to toggle source
Get supertype from object, if possible
# File lib/social_stream/models/supertype.rb, line 48 def normalize(a) case a when self a when Integer find a when Array a.map{ |e| normalize(e) } else begin a.__send__ "#{ name.underscore }!" # a.actor! rescue raise "Unable to normalize #{ self } #{ a.inspect }" end end end
normalize_id(a)
click to toggle source
Get the supertype id from an object, if possible
# File lib/social_stream/models/supertype.rb, line 34 def normalize_id(a) case a when Integer a when String a.to_i when Array a.map{ |e| normalize_id(e) } else normalize(a).id end end
subtypes()
click to toggle source
# File lib/social_stream/models/supertype.rb, line 29 def subtypes SocialStream.__send__ subtypes_name.to_s.tableize # SocialStream.subjects # => [:user, :group ] end
subtypes_name()
click to toggle source
# File lib/social_stream/models/supertype.rb, line 25 def subtypes_name # :subject @subtypes_name end