Class: Entrance::Agent::Acl::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/entrance/agent/acl/base.rb

Direct Known Subclasses

UrlBackendRouter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
14
# File 'lib/entrance/agent/acl/base.rb', line 8

def initialize params={}
  @as_digest   = params[:as_digest]
  @as_digest ||= true if @as_digest.nil?
  @comparator  = params[:comparator]
  @value       = params[:value]
  @name        = params[:name]
end

Instance Attribute Details

#as_digestObject

Returns the value of attribute as_digest.



7
8
9
# File 'lib/entrance/agent/acl/base.rb', line 7

def as_digest
  @as_digest
end

#comparatorObject

Returns the value of attribute comparator.



7
8
9
# File 'lib/entrance/agent/acl/base.rb', line 7

def comparator
  @comparator
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/entrance/agent/acl/base.rb', line 7

def name
  @name
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/entrance/agent/acl/base.rb', line 7

def value
  @value
end

Instance Method Details

#aclObject



15
16
17
18
19
20
21
22
# File 'lib/entrance/agent/acl/base.rb', line 15

def acl
  @acl = []
  @acl << "acl"
  @acl << label
  @acl << comparator
  @acl << value
  @acl.join(" ")
end

#conditionObject



26
27
28
# File 'lib/entrance/agent/acl/base.rb', line 26

def condition
  "if #{label}"
end

#labelObject



23
24
25
# File 'lib/entrance/agent/acl/base.rb', line 23

def label
  as_digest ? Digest::MD5.hexdigest(name) : name
end