Class | Request::Base::EventCollection |
In: |
lib/violet/request.rb
|
Parent: | Event |
create a new EventCollection with two childrens.
# 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
needed by Enumerable module. usage should be obvious :)
# 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.
# File lib/violet/request.rb, line 68 68: def to_url 69: @childrens.collect { |e| e.to_url }.join('&') 70: end