Class: Metanorma::Release::Channel
- Inherits:
-
Object
- Object
- Metanorma::Release::Channel
- Defined in:
- lib/metanorma/release/channel.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name) ⇒ Channel
constructor
A new instance of Channel.
- #matches?(filter_channels) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ Channel
Returns a new instance of Channel.
8 9 10 11 |
# File 'lib/metanorma/release/channel.rb', line 8 def initialize(name) @name = name.to_s.strip freeze end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/metanorma/release/channel.rb', line 6 def name @name end |
Class Method Details
.parse(channel_string) ⇒ Object
29 30 31 |
# File 'lib/metanorma/release/channel.rb', line 29 def self.parse(channel_string) new(channel_string.to_s.strip) end |
.parse_list(strings) ⇒ Object
33 34 35 |
# File 'lib/metanorma/release/channel.rb', line 33 def self.parse_list(strings) (strings || []).map { |s| parse(s) } end |
Instance Method Details
#eql?(other) ⇒ Boolean
17 18 19 |
# File 'lib/metanorma/release/channel.rb', line 17 def eql?(other) other.is_a?(self.class) && @name == other.name end |
#hash ⇒ Object
21 22 23 |
# File 'lib/metanorma/release/channel.rb', line 21 def hash @name.hash end |
#matches?(filter_channels) ⇒ Boolean
25 26 27 |
# File 'lib/metanorma/release/channel.rb', line 25 def matches?(filter_channels) filter_channels.any? { |c| eql?(Channel.new(c)) } end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/metanorma/release/channel.rb', line 13 def to_s @name end |