Class: Nfe::ListResponse
- Inherits:
-
Data
- Object
- Data
- Nfe::ListResponse
- Includes:
- Enumerable, Enumerable[untyped]
- Defined in:
- lib/nfe/pagination.rb,
sig/nfe/pagination.rbs
Overview
A list of hydrated DTOs (+data+) plus its pagination metadata (+page+).
data is iterated identically regardless of pagination shape.
Includes Enumerable (delegating each to data), so a list response is
usable directly anywhere an Enumerable is expected — map, select,
each_with_index, ... — without first reaching into data.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Class Method Summary collapse
Instance Method Summary collapse
-
#each {|item, arg0| ... } ⇒ Enumerator
Iterate the hydrated DTOs in
data. -
#initialize(data: [], page: nil) ⇒ ListResponse
constructor
A new instance of ListResponse.
Constructor Details
#initialize(data: [], page: nil) ⇒ ListResponse
Returns a new instance of ListResponse.
39 40 41 |
# File 'lib/nfe/pagination.rb', line 39 def initialize(data: [], page: nil) super end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
21 22 23 |
# File 'sig/nfe/pagination.rbs', line 21 def data @data end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
22 23 24 |
# File 'sig/nfe/pagination.rbs', line 22 def page @page end |
Class Method Details
.new ⇒ instance
24 |
# File 'sig/nfe/pagination.rbs', line 24
def self.new: (?data: untyped, ?page: untyped) -> instance
|
Instance Method Details
#each ⇒ void #each ⇒ Enumerator[untyped, void]
Iterate the hydrated DTOs in data.
47 48 49 50 51 |
# File 'lib/nfe/pagination.rb', line 47 def each(&) return enum_for(:each) unless block_given? data.each(&) end |