Class: CloudParty::Responses::Node::Permissions
- Inherits:
-
Object
- Object
- CloudParty::Responses::Node::Permissions
- Defined in:
- lib/cloud_party/responses/nodes/zones/permissions.rb,
lib/cloud_party/responses/nodes/memberships/permissions.rb
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
-
#perms ⇒ Object
readonly
Returns the value of attribute perms.
Instance Method Summary collapse
-
#initialize(hsh) ⇒ Permissions
constructor
A new instance of Permissions.
- #inspect ⇒ Object
- #parse_perm(perm) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(hsh) ⇒ Permissions
Returns a new instance of Permissions.
7 8 9 10 11 12 13 14 |
# File 'lib/cloud_party/responses/nodes/zones/permissions.rb', line 7 def initialize(array) @perms = {} array.each do |perm| perm_obj = parse_perm(perm) @perms[perm_obj[:perm_name]] ||= [] @perms[perm_obj[:perm_name]] << perm_obj[:perm_value] end end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
16 17 18 |
# File 'lib/cloud_party/responses/nodes/memberships/permissions.rb', line 16 def list @list end |
#perms ⇒ Object (readonly)
Returns the value of attribute perms.
21 22 23 |
# File 'lib/cloud_party/responses/nodes/zones/permissions.rb', line 21 def perms @perms end |
Instance Method Details
#inspect ⇒ Object
27 28 29 |
# File 'lib/cloud_party/responses/nodes/zones/permissions.rb', line 27 def inspect to_s end |
#parse_perm(perm) ⇒ Object
16 17 18 19 |
# File 'lib/cloud_party/responses/nodes/zones/permissions.rb', line 16 def parse_perm(perm) pattern = /\#(?<perm_name>.+):(?<perm_value>.+)/ pattern.match(perm) end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/cloud_party/responses/nodes/zones/permissions.rb', line 23 def to_s "#<Permissions: #{perms}>" end |