Class: Plat::Role::Basic
- Inherits:
-
Object
show all
- Extended by:
- Forwardable
- Defined in:
- lib/plat/role/basic.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(layout, role, options) ⇒ Basic
Returns a new instance of Basic.
12
13
14
15
16
17
18
19
20
|
# File 'lib/plat/role/basic.rb', line 12
def initialize(layout,role,options)
@layout = layout
@role = role
@options = options.
merge(Hash(options[:default])).
merge(Hash(options["default"])).
merge(Hash(options[env.to_sym])).
merge(Hash(options[env.to_s]))
end
|
Instance Attribute Details
#layout ⇒ Object
Returns the value of attribute layout.
8
9
10
|
# File 'lib/plat/role/basic.rb', line 8
def layout
@layout
end
|
#options ⇒ Object
Returns the value of attribute options.
8
9
10
|
# File 'lib/plat/role/basic.rb', line 8
def options
@options
end
|
#role ⇒ Object
Returns the value of attribute role.
8
9
10
|
# File 'lib/plat/role/basic.rb', line 8
def role
@role
end
|
Instance Method Details
#allow_access(policy, access_type) ⇒ Object
43
44
45
46
|
# File 'lib/plat/role/basic.rb', line 43
def allow_access(policy,access_type)
end
|
#count ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/plat/role/basic.rb', line 21
def count
@count ||= begin
value = options.fetch(:count) { 1 }.to_i
raise ArgumentError.new "Wrong count for role #{@role}: #{options[:count]}" if value < 1
value
end
end
|
#inspect ⇒ Object
36
37
38
|
# File 'lib/plat/role/basic.rb', line 36
def inspect
"<#{self.class} role='#{self.role}'>"
end
|
#resource_name(id = 0) ⇒ Object
32
33
34
|
# File 'lib/plat/role/basic.rb', line 32
def resource_name(id=0)
layout.aws_resource_name(role,id)
end
|
#to_s ⇒ Object
39
40
41
|
# File 'lib/plat/role/basic.rb', line 39
def to_s
{ role => Hash(options) }.to_s
end
|
#type ⇒ Object
28
29
30
|
# File 'lib/plat/role/basic.rb', line 28
def type
Plat::Role.registered_types.find(->{[nil]}) { |elem| elem[1] == self.class }.first
end
|