Class: ParamsReady::QueryContext
- Inherits:
-
Object
- Object
- ParamsReady::QueryContext
- Extended by:
- Forwardable
- Includes:
- Restriction::Wrapper
- Defined in:
- lib/params_ready/query_context.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Attributes included from Restriction::Wrapper
Instance Method Summary collapse
- #clone(restriction:) ⇒ Object
-
#initialize(restriction, data = {}) ⇒ QueryContext
constructor
A new instance of QueryContext.
Methods included from Restriction::Wrapper
#delegate, #for_children, #permit, #permit_all, #prohibit, #to_restriction
Constructor Details
#initialize(restriction, data = {}) ⇒ QueryContext
Returns a new instance of QueryContext.
11 12 13 14 15 |
# File 'lib/params_ready/query_context.rb', line 11 def initialize(restriction, data = {}) @data = data.freeze raise ParamsReadyError, "Restriction expected, got: #{restriction.inspect}" unless restriction.is_a? Restriction @restriction = restriction.freeze end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
8 9 10 |
# File 'lib/params_ready/query_context.rb', line 8 def data @data end |
Instance Method Details
#clone(restriction:) ⇒ Object
17 18 19 |
# File 'lib/params_ready/query_context.rb', line 17 def clone(restriction:) QueryContext.new restriction, data end |