class Sanction::AttachedList

Attributes

key[RW]
parent[RW]

Public Class Methods

new(array = []) click to toggle source
Calls superclass method
# File lib/sanction/attached_list.rb, line 6
def initialize(array = [])
  super(array)
end

Public Instance Methods

[](index) click to toggle source
# File lib/sanction/attached_list.rb, line 10
def [](index)
  detect {|x| x.id == index} || wildcard_member || null_node_class.new({id: index, type: key, scope: []}, @parent)
end
allowed_ids() click to toggle source
# File lib/sanction/attached_list.rb, line 26
def allowed_ids
  []
end
denied_ids() click to toggle source
# File lib/sanction/attached_list.rb, line 22
def denied_ids
  []
end
has_scope?(scope) click to toggle source
# File lib/sanction/attached_list.rb, line 30
def has_scope? scope
  @parent.has_scope? scope
end
ids_blank?() click to toggle source
# File lib/sanction/attached_list.rb, line 18
def ids_blank?
  denied_ids.blank? && allowed_ids.blank?
end
resources() click to toggle source
# File lib/sanction/attached_list.rb, line 46
def resources
  @parent.resources
end
type() click to toggle source
# File lib/sanction/attached_list.rb, line 14
def type
  key
end
wildcard_member() click to toggle source
# File lib/sanction/attached_list.rb, line 34
def wildcard_member
  detect {|x| x.wildcarded? }
end
wildcard_resource?() click to toggle source
# File lib/sanction/attached_list.rb, line 42
def wildcard_resource?
  resources.include?(:*)
end
wildcarded?() click to toggle source
# File lib/sanction/attached_list.rb, line 38
def wildcarded?
  !!wildcard_member
end

Private Instance Methods

null_node_class() click to toggle source
# File lib/sanction/attached_list.rb, line 52
def null_node_class
  raise NotImplementedError
end