Class: Klomp::Frames::Frame
- Inherits:
-
Object
- Object
- Klomp::Frames::Frame
show all
- Defined in:
- lib/klomp/frames.rb
Instance Method Summary
collapse
Instance Method Details
#[](key) ⇒ Object
9
|
# File 'lib/klomp/frames.rb', line 9
def [](key); [key]; end
|
#[]=(key, value) ⇒ Object
10
|
# File 'lib/klomp/frames.rb', line 10
def []=(key, value); [key] = value; end
|
#body ⇒ Object
12
|
# File 'lib/klomp/frames.rb', line 12
def body; @body ||= ""; end
|
#body=(b) ⇒ Object
13
|
# File 'lib/klomp/frames.rb', line 13
def body=(b); @body = b; end
|
19
20
21
22
23
|
# File 'lib/klomp/frames.rb', line 19
def
.map do |pair|
pair.map {|x| x.to_s.gsub("\n","\\n").gsub(":","\\c").gsub("\\", "\\\\") }.join(':')
end.join("\n").tap {|s| s << "\n" unless s.empty? }
end
|
8
|
# File 'lib/klomp/frames.rb', line 8
def ; ||= {}; end
|
#name ⇒ Object
6
|
# File 'lib/klomp/frames.rb', line 6
def name; @name ||= self.class.name.split('::').last.upcase; end
|
#to_s ⇒ Object
15
16
17
|
# File 'lib/klomp/frames.rb', line 15
def to_s
"#{name}\n#{dump_headers}\n#{@body}#{FRAME_SEP}"
end
|