Class: Fib::Container

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/fib/container.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, name) ⇒ Container

Returns a new instance of Container.



12
13
14
15
16
17
18
19
20
21
# File 'lib/fib/container.rb', line 12

def initialize key, name
  @key = key
  @name = name
  @permissions = Fib::PermissionsCollection.new
  @config = Fib::Config.new
  @fpa = Fib::Fpa.new

  @permissions.container = self
  self.class.containers << self
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



5
6
7
# File 'lib/fib/container.rb', line 5

def config
  @config
end

#fpaObject

Returns the value of attribute fpa.



5
6
7
# File 'lib/fib/container.rb', line 5

def fpa
  @fpa
end

#keyObject

Returns the value of attribute key.



5
6
7
# File 'lib/fib/container.rb', line 5

def key
  @key
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/fib/container.rb', line 5

def name
  @name
end

#permissionsObject

Returns the value of attribute permissions.



5
6
7
# File 'lib/fib/container.rb', line 5

def permissions
  @permissions
end

Instance Method Details

#build(&block) ⇒ Object



36
37
38
# File 'lib/fib/container.rb', line 36

def build &block
  permissions.instance_exec &block
end

#configure(&block) ⇒ Object



23
24
25
26
# File 'lib/fib/container.rb', line 23

def configure &block
  config_configure &block
  loading!
end

#load_fpaObject



32
33
34
# File 'lib/fib/container.rb', line 32

def load_fpa
  fpa.redis = config.redis
end

#loading!Object



28
29
30
# File 'lib/fib/container.rb', line 28

def loading!
  load_fpa
end

#restore_permissions(redis_key) ⇒ Object



40
41
42
43
# File 'lib/fib/container.rb', line 40

def restore_permissions redis_key
  return unless keys = fpa.get(redis_key)
  permissions.extract_by_keys keys
end