Class: Hecks::QuerySpecification::Common::Options
- Inherits:
-
Object
- Object
- Hecks::QuerySpecification::Common::Options
- Defined in:
- lib/hecks/query_specification/common/options.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#authorization ⇒ Object
readonly
Returns the value of attribute authorization.
-
#cursor ⇒ Object
readonly
Returns the value of attribute cursor.
-
#inspection ⇒ Object
readonly
Returns the value of attribute inspection.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#null_semantics ⇒ Object
readonly
Returns the value of attribute null_semantics.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#order_by ⇒ Object
readonly
Returns the value of attribute order_by.
-
#wheres ⇒ Object
readonly
Returns the value of attribute wheres.
Instance Method Summary collapse
- #extra_options_to_h ⇒ Object
-
#initialize(wheres: [], order_by: nil, limit: nil, offset: nil, cursor: nil, authorization: nil, inspection: nil, null_semantics: NullSemantics.default) ⇒ Options
constructor
A new instance of Options.
- #options_to_h ⇒ Object
Constructor Details
#initialize(wheres: [], order_by: nil, limit: nil, offset: nil, cursor: nil, authorization: nil, inspection: nil, null_semantics: NullSemantics.default) ⇒ Options
Returns a new instance of Options.
10 11 12 13 14 15 |
# File 'lib/hecks/query_specification/common/options.rb', line 10 def initialize(wheres: [], order_by: nil, limit: nil, offset: nil, cursor: nil, authorization: nil, inspection: nil, null_semantics: NullSemantics.default) @wheres, @order_by, @limit, @offset, @cursor = wheres, order_by, limit, offset, cursor @authorization, @null_semantics, @inspection = , null_semantics, inspection end |
Instance Attribute Details
#authorization ⇒ Object (readonly)
Returns the value of attribute authorization.
7 8 9 |
# File 'lib/hecks/query_specification/common/options.rb', line 7 def @authorization end |
#cursor ⇒ Object (readonly)
Returns the value of attribute cursor.
7 8 9 |
# File 'lib/hecks/query_specification/common/options.rb', line 7 def cursor @cursor end |
#inspection ⇒ Object (readonly)
Returns the value of attribute inspection.
7 8 9 |
# File 'lib/hecks/query_specification/common/options.rb', line 7 def inspection @inspection end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
7 8 9 |
# File 'lib/hecks/query_specification/common/options.rb', line 7 def limit @limit end |
#null_semantics ⇒ Object (readonly)
Returns the value of attribute null_semantics.
7 8 9 |
# File 'lib/hecks/query_specification/common/options.rb', line 7 def null_semantics @null_semantics end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
7 8 9 |
# File 'lib/hecks/query_specification/common/options.rb', line 7 def offset @offset end |
#order_by ⇒ Object (readonly)
Returns the value of attribute order_by.
7 8 9 |
# File 'lib/hecks/query_specification/common/options.rb', line 7 def order_by @order_by end |
#wheres ⇒ Object (readonly)
Returns the value of attribute wheres.
7 8 9 |
# File 'lib/hecks/query_specification/common/options.rb', line 7 def wheres @wheres end |
Instance Method Details
#extra_options_to_h ⇒ Object
23 24 25 26 27 28 |
# File 'lib/hecks/query_specification/common/options.rb', line 23 def .reject { |key, value| value.nil? || value == [] || (key == :null_semantics && value == { mode: "native" }) } .reject { |key, _| %i[wheres order_by limit].include?(key) } end |
#options_to_h ⇒ Object
17 18 19 20 21 |
# File 'lib/hecks/query_specification/common/options.rb', line 17 def { wheres: @wheres.map(&:to_h), order_by: @order_by&.to_h, limit: @limit&.to_h, offset: @offset&.to_h, cursor: @cursor&.to_h, authorization: @authorization&.to_h, null_semantics: @null_semantics&.to_h, inspection: @inspection&.to_h } end |