Class: StreamBuilder
- Inherits:
-
Object
- Object
- StreamBuilder
- Defined in:
- lib/StreamBuilder.rb
Instance Method Summary collapse
- #add(*args) ⇒ Object
- #f(fieldList) ⇒ Object
-
#initialize ⇒ StreamBuilder
constructor
A new instance of StreamBuilder.
- #serialize ⇒ Object
- #set(name, value) ⇒ Object
Constructor Details
#initialize ⇒ StreamBuilder
Returns a new instance of StreamBuilder.
6 7 8 |
# File 'lib/StreamBuilder.rb', line 6 def initialize @h = Hash['v',1,'d',{},'f',[],'l',[]] end |
Instance Method Details
#add(*args) ⇒ Object
21 22 23 24 25 |
# File 'lib/StreamBuilder.rb', line 21 def add( *args ) @h['l'].concat args return self end |
#f(fieldList) ⇒ Object
15 16 17 18 19 |
# File 'lib/StreamBuilder.rb', line 15 def f( fieldList ) @h['f'] = fieldList return self end |
#serialize ⇒ Object
27 28 29 |
# File 'lib/StreamBuilder.rb', line 27 def serialize return @h.to_json end |
#set(name, value) ⇒ Object
10 11 12 13 |
# File 'lib/StreamBuilder.rb', line 10 def set( name, value ) @h['d'][name] = value return self end |