Class: Hyrax::Group

Inherits:
Object
  • Object
show all
Defined in:
app/models/hyrax/group.rb

Constant Summary collapse

DEFAULT_NAME_PREFIX =
'group/'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Group

Returns a new instance of Group.


16
17
18
# File 'app/models/hyrax/group.rb', line 16

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.


20
21
22
# File 'app/models/hyrax/group.rb', line 20

def name
  @name
end

Class Method Details

.from_agent_key(key) ⇒ Hyrax::Group

Returns:


12
13
14
# File 'app/models/hyrax/group.rb', line 12

def self.from_agent_key(key)
  new(key.delete_prefix(name_prefix))
end

.name_prefixObject


6
7
8
# File 'app/models/hyrax/group.rb', line 6

def self.name_prefix
  DEFAULT_NAME_PREFIX
end

Instance Method Details

#==(other) ⇒ Boolean

Returns:

  • (Boolean)

24
25
26
# File 'app/models/hyrax/group.rb', line 24

def ==(other)
  other.class == self.class && other.name == name
end

#agent_keyString

Returns a local identifier for this group; for use (e.g.) in ACL data.

Returns:

  • (String)

    a local identifier for this group; for use (e.g.) in ACL data


31
32
33
# File 'app/models/hyrax/group.rb', line 31

def agent_key
  self.class.name_prefix + name
end

#to_sipity_agentObject


35
36
37
# File 'app/models/hyrax/group.rb', line 35

def to_sipity_agent
  sipity_agent || create_sipity_agent!
end