class Smith::ACL::Factory
Public Class Methods
create(type, content=nil, &blk)
click to toggle source
# File lib/smith/messaging/factory.rb, line 10 def create(type, content=nil, &blk) if type.respond_to?(:serialize_to_string) return type else clazz = (type.is_a?(::Protobuf::Message)) ? type : class_from_name(type) if blk clazz.new.tap { |m| blk.call(m) } else (content.nil?) ? clazz.new : clazz.new(content) end end end