Class: ConfCtl::Swpins::ChannelList

Inherits:
Array
  • Object
show all
Defined in:
lib/confctl/swpins/channel_list.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern: '*') ⇒ ChannelList

Returns a new instance of ChannelList.

Parameters:

  • pattern (String) (defaults to: '*')


18
19
20
21
# File 'lib/confctl/swpins/channel_list.rb', line 18

def initialize(pattern: '*')
  super()
  parse(pattern:)
end

Class Method Details

.getSwpins::ChannelList

Returns:



4
5
6
# File 'lib/confctl/swpins/channel_list.rb', line 4

def self.get
  @get ||= new
end

.pattern(pattern) ⇒ Object

Parameters:

  • pattern (String)


9
10
11
# File 'lib/confctl/swpins/channel_list.rb', line 9

def self.pattern(pattern)
  get.pattern(pattern)
end

.refreshObject



13
14
15
# File 'lib/confctl/swpins/channel_list.rb', line 13

def self.refresh
  get.refresh
end

Instance Method Details

#pattern(pattern) ⇒ Array<Swpins::Channel>

Parameters:

  • pattern (String)

Returns:



25
26
27
# File 'lib/confctl/swpins/channel_list.rb', line 25

def pattern(pattern)
  select { |c| Pattern.match?(pattern, c.name) }
end

#refreshObject



29
30
31
32
# File 'lib/confctl/swpins/channel_list.rb', line 29

def refresh
  clear
  parse
end