Class: Sanity::Groq::Slice
- Inherits:
-
Object
- Object
- Sanity::Groq::Slice
- Defined in:
- lib/sanity/groq/slice.rb
Constant Summary collapse
- RESERVED =
%i[limit offset]
- ZERO_INDEX =
0
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**args) ⇒ Slice
constructor
A new instance of Slice.
Constructor Details
Instance Attribute Details
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
15 16 17 |
# File 'lib/sanity/groq/slice.rb', line 15 def limit @limit end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
15 16 17 |
# File 'lib/sanity/groq/slice.rb', line 15 def offset @offset end |
Class Method Details
.call(**args) ⇒ Object
7 8 9 |
# File 'lib/sanity/groq/slice.rb', line 7 def call(**args) new(**args).call end |
Instance Method Details
#call ⇒ Object
24 25 26 27 28 |
# File 'lib/sanity/groq/slice.rb', line 24 def call return "" unless limit (!offset) ? zero_index_to_limit : offset_to_limit end |