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
14
|
# File 'lib/klomp/frames.rb', line 14
def [](key); [key]; end
|
#[]=(key, value) ⇒ Object
15
|
# File 'lib/klomp/frames.rb', line 15
def []=(key, value); [key] = value; end
|
#body ⇒ Object
17
|
# File 'lib/klomp/frames.rb', line 17
def body; @body ||= ""; end
|
#body=(b) ⇒ Object
18
|
# File 'lib/klomp/frames.rb', line 18
def body=(b); @body = b; end
|
24
25
26
27
28
|
# File 'lib/klomp/frames.rb', line 24
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
|
13
|
# File 'lib/klomp/frames.rb', line 13
def ; @headers ||= ; end
|
#name ⇒ Object
6
|
# File 'lib/klomp/frames.rb', line 6
def name; @name ||= self.class.name.split('::').last.upcase; end
|
8
9
10
11
|
# File 'lib/klomp/frames.rb', line 8
def
{}
end
|
30
31
32
33
34
|
# File 'lib/klomp/frames.rb', line 30
def (hdrs)
new_hdrs = {}
hdrs.each { |k, v| new_hdrs[k.to_s] = v }
new_hdrs
end
|
#to_s ⇒ Object
20
21
22
|
# File 'lib/klomp/frames.rb', line 20
def to_s
"#{name}\n#{}\n#{@body}#{FRAME_SEP}"
end
|