Object
@abstract Subclass and override to implement custom frames
Initialize frame @param args [Hash] Arguments for frame @option args [String] :data default data for frame @option args [String] :type Type of frame - available types are "text", "binary", "ping", "pong" and "close"(support depends on draft version) @option args [Integer] :code Code for close frame. Supported by drafts > 05. @option args [Integer] :version Version of draft. Currently supported version are 75, 76 and 00-13.
# File lib/websocket/frame/base.rb, line 14 def initialize(args = {}) @type = args[:type].to_sym if args[:type] @code = args[:code] @data = Data.new(args[:data].to_s) @version = args[:version] || DEFAULT_VERSION include_version end
Check if some errors occured @return [Boolean] True if error is set
# File lib/websocket/frame/base.rb, line 24 def error? !!@error end
Recreate inspect as to_s was overwritten
# File lib/websocket/frame/base.rb, line 39 def inspect vars = self.instance_variables.map{|v| "#{v}=#{instance_variable_get(v).inspect}"}.join(", ") insp = "#{self.class}:0x%08x" % (self.__id__ * 2) "<#{insp} #{vars}>" end
Generated with the Darkfish Rdoc Generator 2.