Module: ParamsReady::Restriction::Wrapper

Extended by:
Forwardable
Included in:
Intent, QueryContext
Defined in:
lib/params_ready/restriction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#restrictionObject (readonly)

Returns the value of attribute restriction.



5
6
7
# File 'lib/params_ready/restriction.rb', line 5

def restriction
  @restriction
end

Instance Method Details

#delegate(*args) ⇒ Object



8
9
10
11
12
13
# File 'lib/params_ready/restriction.rb', line 8

def delegate(*args)
  return self if @restriction.everything?

  new_restriction = @restriction.delegate(*args)
  clone(restriction: new_restriction)
end

#for_children(parameter) ⇒ Object



15
16
17
18
19
20
# File 'lib/params_ready/restriction.rb', line 15

def for_children(parameter)
  return self if @restriction.everything?

  new_restriction = @restriction.for_children parameter
  clone(restriction: new_restriction)
end

#permit(*list) ⇒ Object



28
29
30
31
32
33
# File 'lib/params_ready/restriction.rb', line 28

def permit(*list)
  restriction = Restriction.permit(*list)
  return self if @restriction.everything? && restriction.everything?

  clone(restriction: restriction)
end

#permit_allObject



22
23
24
25
26
# File 'lib/params_ready/restriction.rb', line 22

def permit_all
  return self if @restriction.everything?

  clone(restriction: Restriction.blanket_permission)
end

#prohibit(*list) ⇒ Object



35
36
37
38
39
40
# File 'lib/params_ready/restriction.rb', line 35

def prohibit(*list)
  restriction = Restriction.prohibit(*list)
  return self if @restriction.everything? && restriction.everything?

  clone(restriction: restriction)
end

#to_restrictionObject



42
43
44
# File 'lib/params_ready/restriction.rb', line 42

def to_restriction
  @restriction
end