Class: WebHookPublisher::Acl::RecordBase

Inherits:
Object
  • Object
show all
Defined in:
lib/webhook-publisher/acl.rb

Direct Known Subclasses

AllowRecord, DenyRecord

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ipaddr) ⇒ RecordBase

Returns a new instance of RecordBase.



56
57
58
59
60
61
62
63
64
# File 'lib/webhook-publisher/acl.rb', line 56

def initialize(ipaddr)
  @ipaddr =
    case ipaddr
    when :all   then IPAddr.new("0.0.0.0/0")
    when String then IPAddr.new(ipaddr)
    when IPAddr then ipaddr
    else raise(ArgumentError, "invalid IP address")
    end
end

Instance Attribute Details

#ipaddrObject (readonly)

Returns the value of attribute ipaddr.



66
67
68
# File 'lib/webhook-publisher/acl.rb', line 66

def ipaddr
  @ipaddr
end

Instance Method Details

#include?(ipaddr) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/webhook-publisher/acl.rb', line 68

def include?(ipaddr)
  return @ipaddr.include?(ipaddr)
end