Sha256: cbf116b7c7becd6bd558b211227ad2e2fa4b4b284e04148248e2baa101f18113
Contents?: true
Size: 995 Bytes
Versions: 3
Compression:
Stored size: 995 Bytes
Contents
module Gecko module Pusher module Channel class Rag < Base def push(*args) data = if is_basic_rag?(*args) { item: [ { value: args[0] }, { value: args[1] }, { value: args[2] } ] } elsif is_basic_rag_with_descriptions?(*args) { item: [ { value: args[0], text: args[1] }, { value: args[2], text: args[3]}, { value: args[4], text: args[5]} ] } end _push(data) end private def is_basic_rag?(*args) args.length == 3 && args.all? {|arg| arg.is_a? Integer} end def is_basic_rag_with_descriptions?(*args) args.length == 6 && args[0].is_a?(Integer) && args[2].is_a?(Integer) && args[4].is_a?(Integer) && args[1].is_a?(String) && args[3].is_a?(String) && args[5].is_a?(String) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gecko-pusher-0.0.3 | lib/gecko-pusher/channel/rag.rb |
gecko-pusher-0.0.2 | lib/gecko-pusher/channel/rag.rb |
gecko-pusher-0.0.1 | lib/gecko-pusher/channel/rag.rb |