Class Request::Base::EventCollection
In: lib/violet/request.rb
Parent: Event
Event Action TtsMessage SetEarsPosition EventCollection Enumerable Query GET_EARS_POSITION Base Request dot/f_8.png

combine many Event in a single request

Methods

each   new   to_url  

Included Modules

Enumerable

Public Class methods

create a new EventCollection with two childrens.

[Source]

    # File lib/violet/request.rb, line 47
47:       def initialize one, another
48:         if one.respond_to?(:to_url) and another.respond_to?(:to_url) # \_o<  Coin !
49:           @childrens = [ one, another ]
50:         else
51:           raise ArgumentError.new('bad parameters')
52:         end
53:       end

Public Instance methods

needed by Enumerable module. usage should be obvious :)

[Source]

    # File lib/violet/request.rb, line 57
57:       def each
58:         @childrens.each do |e|
59:           if e.kind_of? Enumerable
60:             e.each { |i| yield i }
61:           else
62:             yield e
63:           end
64:         end
65:       end

override Event#to_url.

[Source]

    # File lib/violet/request.rb, line 68
68:       def to_url
69:         @childrens.collect { |e| e.to_url }.join('&')
70:       end

[Validate]