Sha256: cd04cb0f8d5f60ccac0aefa45898318b314f13d52a1ac2f11a262ae3476b89f5

Contents?: true

Size: 715 Bytes

Versions: 4

Compression:

Stored size: 715 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
          Channel.new(name)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
octospy-0.0.8 lib/octospy/recordable.rb
octospy-0.0.7 lib/octospy/recordable.rb
octospy-0.0.6 lib/octospy/recordable.rb
octospy-0.0.5 lib/octospy/recordable.rb