Sha256: 56f80e8a371cef4fc3040fae69fe1761cff976914379327c34e20e3515b40810
Contents?: true
Size: 742 Bytes
Versions: 3
Compression:
Stored size: 742 Bytes
Contents
require 'octospy/recordable/channel' module Octospy module Recordable class << self def channels @channels ||= [] end def channels_include?(name) !!find_channel(name) end def find_channel(name) channels.find { |channel| channel.name.to_s == name.to_s } end def add_channel(name) channels << Channel.new(name) unless channels_include? name end def remove_channel(name) channels.delete_if { |channel| channel.name.to_s == name.to_s } end def channel(name) if channels_include? name find_channel name else add_channel name find_channel name end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
octospy-0.2.0 | lib/octospy/recordable.rb |
octospy-0.1.1 | lib/octospy/recordable.rb |
octospy-0.1.0 | lib/octospy/recordable.rb |