Class: Oga::Blacklist Private

Inherits:
Object
  • Object
show all
Defined in:
lib/oga/blacklist.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Direct Known Subclasses

Whitelist

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(names) ⇒ Blacklist

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Blacklist

Parameters:

  • names (Array)


8
9
10
# File 'lib/oga/blacklist.rb', line 8

def initialize(names)
  @names = Set.new(names + names.map(&:upcase))
end

Instance Attribute Details

#namesSet (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Set)


5
6
7
# File 'lib/oga/blacklist.rb', line 5

def names
  @names
end

Instance Method Details

#+(other) ⇒ Oga::Blacklist

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Returns:



26
27
28
# File 'lib/oga/blacklist.rb', line 26

def +(other)
  self.class.new(names + other.names)
end

#allow?(name) ⇒ TrueClass|FalseClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (TrueClass|FalseClass)


20
21
22
# File 'lib/oga/blacklist.rb', line 20

def allow?(name)
  !names.include?(name)
end

#each {|| ... } ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Yield Parameters:

  • (String)


13
14
15
16
17
# File 'lib/oga/blacklist.rb', line 13

def each
  names.each do |value|
    yield value
  end
end