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)


12
13
14
# File 'lib/oga/blacklist.rb', line 12

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)


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

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:



36
37
38
# File 'lib/oga/blacklist.rb', line 36

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)


28
29
30
# File 'lib/oga/blacklist.rb', line 28

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)


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

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