Class: Ddr::Auth::Group
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Ddr::Auth::Group
- Extended by:
- Deprecation
- Defined in:
- lib/ddr/auth/group.rb
Overview
Wraps a String
Instance Attribute Summary collapse
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Instance Method Summary collapse
- #agent ⇒ Object
- #has_member?(auth_context) ⇒ Boolean
- #id ⇒ Object
-
#initialize(id, opts = {}, &rule) ⇒ Group
constructor
A new instance of Group.
- #inspect ⇒ Object
- #label ⇒ Object
- #to_agent ⇒ Object
Constructor Details
#initialize(id, opts = {}, &rule) ⇒ Group
Returns a new instance of Group.
11 12 13 14 15 16 |
# File 'lib/ddr/auth/group.rb', line 11 def initialize(id, opts={}, &rule) super(id) @label = opts[:label] @rule = rule freeze end |
Instance Attribute Details
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
9 10 11 |
# File 'lib/ddr/auth/group.rb', line 9 def rule @rule end |
Instance Method Details
#agent ⇒ Object
31 32 33 |
# File 'lib/ddr/auth/group.rb', line 31 def agent to_s end |
#has_member?(auth_context) ⇒ Boolean
19 20 21 |
# File 'lib/ddr/auth/group.rb', line 19 def has_member?(auth_context) rule ? instance_exec(auth_context, &rule) : auth_context.member_of?(self) end |
#id ⇒ Object
23 24 25 |
# File 'lib/ddr/auth/group.rb', line 23 def id __getobj__ end |
#inspect ⇒ Object
40 41 42 |
# File 'lib/ddr/auth/group.rb', line 40 def inspect "#<#{self.class.name} id=#{id.inspect}, label=#{label.inspect}>" end |
#label ⇒ Object
27 28 29 |
# File 'lib/ddr/auth/group.rb', line 27 def label @label || id end |
#to_agent ⇒ Object
35 36 37 38 |
# File 'lib/ddr/auth/group.rb', line 35 def to_agent Deprecation.warn(self.class, "`to_agent` is deprecated. Use `agent` instead.") agent end |