Sha256: 2488f4ad329afa004b80e2cc0eb613c6bb7e27f6960caeb78215ae1af566ea81
Contents?: true
Size: 717 Bytes
Versions: 3
Compression:
Stored size: 717 Bytes
Contents
module Aggro module Message # Public: Query message. class Query < Struct.new(:sender, :queryable_id, :details) TYPE_CODE = '15'.freeze def self.parse(string) new string[2..37], string[38..73], parse_details(string[74..-1]) end def self.parse_details(details) Marshal.load details end def args details[:args] end def name details[:name] end def query_class ActiveSupport::Inflector.safe_constantize name end def to_query query_class.new args if query_class end def to_s "#{TYPE_CODE}#{sender}#{queryable_id}#{Marshal.dump details}" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
aggro-0.0.4 | lib/aggro/message/query.rb |
aggro-0.0.3 | lib/aggro/message/query.rb |
aggro-0.0.2 | lib/aggro/message/query.rb |