Class: IdPlease::AssignmentLink

Inherits:
Object
  • Object
show all
Defined in:
lib/id_please/assignment_map.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ AssignmentLink

Returns a new instance of AssignmentLink.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/id_please/assignment_map.rb', line 5

def initialize(*args)
  options = args.extract_options!
  if (assignment = options[:assignment])
    @subject = assignment.subject
    @target = assignment.role.authorizable
    @role = assignment.role.name
  else
    @subject = options.delete(:subject) || raise("subject must be specified")
    @target = options.delete(:target) || raise("target must be specified")
    @role = options.delete(:role) || raise("role must be specified")
  end
  
  @role = @role.to_sym

  @via = options.delete(:via)
end

Instance Attribute Details

#roleObject (readonly)

Returns the value of attribute role.



3
4
5
# File 'lib/id_please/assignment_map.rb', line 3

def role
  @role
end

#subjectObject (readonly)

Returns the value of attribute subject.



3
4
5
# File 'lib/id_please/assignment_map.rb', line 3

def subject
  @subject
end

#targetObject (readonly)

Returns the value of attribute target.



3
4
5
# File 'lib/id_please/assignment_map.rb', line 3

def target
  @target
end

#viaObject (readonly)

Returns the value of attribute via.



3
4
5
# File 'lib/id_please/assignment_map.rb', line 3

def via
  @via
end