Class: Sanction::Blacklist::NullNode
- Inherits:
-
Node
- Object
- Node
- Node
- Sanction::Blacklist::NullNode
show all
- Defined in:
- lib/sanction/blacklist/null_node.rb
Instance Attribute Summary
Attributes inherited from Node
#id, #type
Instance Method Summary
collapse
Methods inherited from Node
#blacklist?, #mode, #scope, #whitelist?
Methods inherited from Node
#[], #add_scope, #add_subject, #change_type!, #children, #children?, #find, #has_scope?, #id?, #initialize, #mode, #remove_scope, #resources, #resources=, #scope, #scope=, #to_hash, #type?, #wildcarded?
Methods included from Tree
#ancestors, #children, #depth, #descendants, #graft, #has_children?, #height, #leaf?, #only_child?, #parent, #prune, #root, #root?, #siblings, #unlink, #walk
Constructor Details
This class inherits a constructor from Sanction::Node
Instance Method Details
#allow! ⇒ Object
11
12
13
|
# File 'lib/sanction/blacklist/null_node.rb', line 11
def allow!
false
end
|
#array_class ⇒ Object
Also known as:
null_array_class
#deny! ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/sanction/blacklist/null_node.rb', line 15
def deny!
ancestors.reject(&:persisted?).each(&:deny!)
@parent = root.find(@parent.type, @parent.id) unless @parent.persisted?
@parent.resources << type
@parent.resources.uniq!
@parent.add_subject({
id: id,
type: type
})
end
|
#permitted? ⇒ Boolean
5
6
7
8
9
|
# File 'lib/sanction/blacklist/null_node.rb', line 5
def permitted?
a = ancestors.reject(&:root?).map(&:permitted?)
a << true
a.all?
end
|
#persisted? ⇒ Boolean
26
27
28
|
# File 'lib/sanction/blacklist/null_node.rb', line 26
def persisted?
false
end
|