Class: WebHookDispatcher::Acl::EntryBase
- Inherits:
-
Object
- Object
- WebHookDispatcher::Acl::EntryBase
- Defined in:
- lib/webhook-dispatcher/acl/entry_base.rb,
lib/webhook-dispatcher/acl/entry_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#addr ⇒ Object
readonly
Returns the value of attribute addr.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(options = nil) ⇒ EntryBase
constructor
A new instance of EntryBase.
- #match?(addr, name, port) ⇒ Boolean
- #to_a ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ EntryBase
Returns a new instance of EntryBase.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/webhook-dispatcher/acl/entry_base.rb', line 12 def initialize( = nil) case when nil, :all @addr = nil @name = nil @port = nil when Hash = .dup @addr = normalize_addr(.delete(:addr)) @name = normalize_name(.delete(:name)) @port = normalize_port(.delete(:port)) raise(ArgumentError) unless .empty? else raise(ArgumentError) end end |
Instance Attribute Details
#addr ⇒ Object (readonly)
Returns the value of attribute addr.
28 29 30 |
# File 'lib/webhook-dispatcher/acl/entry_base.rb', line 28 def addr @addr end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
28 29 30 |
# File 'lib/webhook-dispatcher/acl/entry_base.rb', line 28 def name @name end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
28 29 30 |
# File 'lib/webhook-dispatcher/acl/entry_base.rb', line 28 def port @port end |
Instance Method Details
#==(other) ⇒ Object
30 31 32 33 |
# File 'lib/webhook-dispatcher/acl/entry_base.rb', line 30 def ==(other) return false unless other.instance_of?(self.class) return (self.to_a == other.to_a) end |
#match?(addr, name, port) ⇒ Boolean
35 36 37 |
# File 'lib/webhook-dispatcher/acl/entry_base.rb', line 35 def match?(addr, name, port) return match_addr?(addr) && match_name?(name) && match_port?(port) end |
#to_a ⇒ Object
43 44 45 |
# File 'lib/webhook-dispatcher/acl/entry_base.rb', line 43 def to_a return [@addr, @name, @port] end |
#value ⇒ Object
39 40 41 |
# File 'lib/webhook-dispatcher/acl/entry_base.rb', line 39 def value raise(NotImplementedError) end |